nginx.conf 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. # For more information on configuration, see:
  2. # * Official English Documentation: http://nginx.org/en/docs/
  3. # * Official Russian Documentation: http://nginx.org/ru/docs/
  4. user nginx;
  5. worker_processes auto;
  6. error_log /var/log/nginx/error.log;
  7. pid /run/nginx.pid;
  8. # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
  9. include /usr/share/nginx/modules/*.conf;
  10. events {
  11. worker_connections 1024;
  12. }
  13. http {
  14. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  15. '$status $body_bytes_sent "$http_referer" '
  16. '"$http_user_agent" "$http_x_forwarded_for"';
  17. access_log /var/log/nginx/access.log main;
  18. sendfile on;
  19. tcp_nopush on;
  20. tcp_nodelay on;
  21. keepalive_timeout 65;
  22. types_hash_max_size 4096;
  23. include /etc/nginx/mime.types;
  24. default_type application/octet-stream;
  25. # Load modular configuration files from the /etc/nginx/conf.d directory.
  26. # See http://nginx.org/en/docs/ngx_core_module.html#include
  27. # for more information.
  28. include /etc/nginx/conf.d/*.conf;
  29. server {
  30. listen 80;
  31. server_name kxmall.vip;
  32. root /usr/share/nginx/html;
  33. try_files $uri $uri/ /index.html;
  34. # Load configuration files for the default server block.
  35. include /etc/nginx/default.d/*.conf;
  36. gzip on;
  37. gzip_min_length 1k;
  38. gzip_buffers 4 16k;
  39. gzip_http_version 1.1;
  40. gzip_comp_level 9;
  41. gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php application/javascript application/json;
  42. gzip_disable "MSIE [1-6]\.";
  43. gzip_vary on;
  44. error_page 404 /404.html;
  45. location = /404.html {
  46. }
  47. error_page 500 502 503 504 /50x.html;
  48. location = /50x.html {
  49. }
  50. }
  51. server {
  52. listen 80;
  53. server_name h5.kxmall.vip;
  54. try_files $uri $uri/ /index.html;
  55. gzip on;
  56. gzip_min_length 1k;
  57. gzip_buffers 4 16k;
  58. gzip_http_version 1.1;
  59. gzip_comp_level 9;
  60. gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php application/javascript application/json;
  61. gzip_disable "MSIE [1-6]\.";
  62. gzip_vary on;
  63. location / {
  64. try_files $uri $uri/ /index.html;
  65. root /usr/share/nginx/app;
  66. }
  67. error_page 404 /404.html;
  68. location = /404.html {
  69. }
  70. error_page 500 502 503 504 /50x.html;
  71. location = /50x.html {
  72. }
  73. }
  74. server {
  75. listen 80;
  76. server_name rider.kxmall.vip;
  77. gzip on;
  78. gzip_min_length 1k;
  79. gzip_buffers 4 16k;
  80. gzip_http_version 1.1;
  81. gzip_comp_level 9;
  82. gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php application/javascript application/json;
  83. gzip_disable "MSIE [1-6]\.";
  84. gzip_vary on;
  85. location / {
  86. try_files $uri $uri/ /index.html;
  87. root /usr/share/nginx/rider;
  88. }
  89. error_page 404 /404.html;
  90. location = /404.html {
  91. }
  92. error_page 500 502 503 504 /50x.html;
  93. location = /50x.html {
  94. }
  95. }
  96. upstream server {
  97. ip_hash;
  98. server 172.30.0.60:8585;
  99. }
  100. server {
  101. listen 8585;
  102. server_name localhost;
  103. location / {
  104. proxy_set_header Host $http_host;
  105. proxy_set_header X-Real-IP $remote_addr;
  106. proxy_set_header REMOTE-HOST $remote_addr;
  107. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  108. proxy_pass http://server/;
  109. }
  110. error_page 404 /404.html;
  111. location = /404.html {
  112. }
  113. error_page 500 502 503 504 /50x.html;
  114. location = /50x.html {
  115. }
  116. }
  117. server {
  118. listen 443 ssl;
  119. server_name _;
  120. ssl_certificate /etc/nginx/cert/7963236_www.kxmall.vip.pem; # /etc/nginx/cert/ 为docker映射路径 不允许更改
  121. ssl_certificate_key /etc/nginx/cert/7963236_www.kxmall.vip.key; # /etc/nginx/cert/ 为docker映射路径 不允许更改
  122. ssl_session_cache shared:SSL:1m;
  123. ssl_session_timeout 10m;
  124. ssl_ciphers HIGH:!aNULL:!MD5;
  125. ssl_prefer_server_ciphers on;
  126. location / {
  127. proxy_set_header Host $http_host;
  128. proxy_set_header X-Real-IP $remote_addr;
  129. proxy_set_header REMOTE-HOST $remote_addr;
  130. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  131. proxy_pass http://server/;
  132. }
  133. error_page 404 /404.html;
  134. location = /40x.html {
  135. }
  136. error_page 500 502 503 504 /50x.html;
  137. location = /50x.html {
  138. }
  139. }
  140. }