nginx.conf 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #user nobody;
  2. worker_processes 1;
  3. #error_log logs/error.log;
  4. #error_log logs/error.log notice;
  5. #error_log logs/error.log info;
  6. #pid logs/nginx.pid;
  7. events {
  8. worker_connections 1024;
  9. }
  10. http {
  11. include mime.types;
  12. default_type application/octet-stream;
  13. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  14. # '$status $body_bytes_sent "$http_referer" '
  15. # '"$http_user_agent" "$http_x_forwarded_for"';
  16. access_log logs/access.log main;
  17. #access_log off;
  18. client_max_body_size 50m;
  19. sendfile on;
  20. #tcp_nopush on;
  21. #keepalive_timeout 0;
  22. keepalive_timeout 65;
  23. #gzip on;
  24. server {
  25. listen 998;
  26. server_name 192.168.3.16;
  27. #charset koi8-r;
  28. access_log logs/host.access.log main;
  29. #websocket相关配置
  30. proxy_http_version 1.1;
  31. proxy_set_header Upgrade $http_upgrade;
  32. proxy_set_header Connection "upgrade";
  33. proxy_set_header X-real-ip $remote_addr;
  34. proxy_set_header X-Forwarded-For $remote_addr;
  35. location / {
  36. root "../webs";
  37. index index.html index.htm;
  38. }
  39. location ~ /ISAPI|SDK/ {
  40. if ($http_cookie ~ "webVideoCtrlProxy=(.+)") {
  41. proxy_pass http://$cookie_webVideoCtrlProxy;
  42. break;
  43. }
  44. }
  45. location ^~ /webSocketVideoCtrlProxy {
  46. #web socket
  47. proxy_http_version 1.1;
  48. proxy_set_header Upgrade $http_upgrade;
  49. proxy_set_header Connection "upgrade";
  50. proxy_set_header Host $host;
  51. if ($http_cookie ~ "webVideoCtrlProxyWs=(.+)") {
  52. proxy_pass http://$cookie_webVideoCtrlProxyWs/$cookie_webVideoCtrlProxyWsChannel?$args;
  53. break;
  54. }
  55. if ($http_cookie ~ "webVideoCtrlProxyWss=(.+)") {
  56. proxy_pass http://$cookie_webVideoCtrlProxyWss/$cookie_webVideoCtrlProxyWsChannel?$args;
  57. break;
  58. }
  59. }
  60. #error_page 404 /404.html;
  61. # redirect server error pages to the static page /50x.html
  62. #
  63. error_page 500 502 503 504 /50x.html;
  64. location = /50x.html {
  65. root html;
  66. }
  67. # error_page 302 /50x.html;
  68. # location = /50x.html {
  69. # root html;
  70. # }
  71. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  72. #
  73. #location ~ \.php$ {
  74. # proxy_pass http://127.0.0.1;
  75. #}
  76. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  77. #
  78. #location ~ \.php$ {
  79. # root html;
  80. # fastcgi_pass 127.0.0.1:9000;
  81. # fastcgi_index index.php;
  82. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  83. # include fastcgi_params;
  84. #}
  85. # deny access to .htaccess files, if Apache's document root
  86. # concurs with nginx's one
  87. #
  88. #location ~ /\.ht {
  89. # deny all;
  90. #}
  91. }
  92. # another virtual host using mix of IP-, name-, and port-based configuration
  93. #
  94. #server {
  95. # listen 8000;
  96. # listen somename:8080;
  97. # server_name somename alias another.alias;
  98. # location / {
  99. # root html;
  100. # index index.html index.htm;
  101. # }
  102. #}
  103. # HTTPS server
  104. #
  105. #server {
  106. # listen 443 ssl;
  107. # server_name localhost;
  108. # ssl_certificate cert.pem;
  109. # ssl_certificate_key cert.key;
  110. # ssl_session_cache shared:SSL:1m;
  111. # ssl_session_timeout 5m;
  112. # ssl_ciphers HIGH:!aNULL:!MD5;
  113. # ssl_prefer_server_ciphers on;
  114. # location / {
  115. # root html;
  116. # index index.html index.htm;
  117. # }
  118. #}
  119. }