Нет описания

nginx.conf 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. user root;
  2. worker_processes auto;
  3. pid /run/nginx.pid;
  4. include /etc/nginx/modules-enabled/*.conf;
  5. events {
  6. worker_connections 768;
  7. # multi_accept on;
  8. }
  9. http {
  10. ##
  11. # Basic Settings
  12. ##
  13. sendfile on;
  14. tcp_nopush on;
  15. tcp_nodelay on;
  16. keepalive_timeout 65;
  17. types_hash_max_size 2048;
  18. # server_tokens off;
  19. # server_names_hash_bucket_size 64;
  20. # server_name_in_redirect off;
  21. include /etc/nginx/mime.types;
  22. default_type application/octet-stream;
  23. ##
  24. # SSL Settings
  25. ##
  26. ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
  27. ssl_prefer_server_ciphers on;
  28. ##
  29. # Logging Settings
  30. ##
  31. access_log /var/log/nginx/access.log;
  32. error_log /var/log/nginx/error.log;
  33. ##
  34. # Gzip Settings
  35. ##
  36. gzip on;
  37. # 大屏应用配置
  38. server {
  39. listen 9998;
  40. server_name 47.93.202.126;
  41. # location = /bigScreen {
  42. # return 302 $scheme://$http_host/bigScreen/;
  43. # }
  44. location /bigScreen/ {
  45. alias /home/website/zlzh/bigScreen/dist/;
  46. try_files $uri $uri/ /index.html;
  47. # 静态文件缓存
  48. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
  49. expires 1y;
  50. add_header Cache-Control "public, immutable";
  51. }
  52. }
  53. # API代理配置
  54. location /api {
  55. # 这里需要替换为你的实际API服务器地址
  56. proxy_pass http://127.0.0.1:8080; # 请修改为你的API服务器地址
  57. proxy_set_header Host $host;
  58. proxy_set_header X-Real-IP $remote_addr;
  59. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  60. proxy_set_header X-Forwarded-Proto $scheme;
  61. # 代理超时设置
  62. proxy_connect_timeout 60s;
  63. proxy_send_timeout 60s;
  64. proxy_read_timeout 60s;
  65. # WebSocket支持(如果需要)
  66. proxy_http_version 1.1;
  67. proxy_set_header Upgrade $http_upgrade;
  68. proxy_set_header Connection "upgrade";
  69. }
  70. # Web应用配置(根目录)
  71. location / {
  72. root /home/website/zlzh/web/dist;
  73. try_files $uri $uri/ /index.html;
  74. # 静态文件缓存
  75. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
  76. expires 1y;
  77. add_header Cache-Control "public, immutable";
  78. }
  79. }
  80. }
  81. # Web应用和API配置
  82. server {
  83. listen 10000;
  84. server_name zhyh.hnyulin.com;
  85. # API代理配置
  86. location /api {
  87. # 这里需要替换为你的实际API服务器地址
  88. proxy_pass http://127.0.0.1:8080; # 请修改为你的API服务器地址
  89. proxy_set_header Host $host;
  90. proxy_set_header X-Real-IP $remote_addr;
  91. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  92. proxy_set_header X-Forwarded-Proto $scheme;
  93. # 代理超时设置
  94. proxy_connect_timeout 60s;
  95. proxy_send_timeout 60s;
  96. proxy_read_timeout 60s;
  97. # WebSocket支持(如果需要)
  98. proxy_http_version 1.1;
  99. proxy_set_header Upgrade $http_upgrade;
  100. proxy_set_header Connection "upgrade";
  101. }
  102. # Web应用配置(根目录)
  103. location / {
  104. root /home/website/zlzh/web;
  105. try_files $uri $uri/ /index.html;
  106. # 静态文件缓存
  107. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
  108. expires 1y;
  109. add_header Cache-Control "public, immutable";
  110. }
  111. }
  112. # 通用配置
  113. # access_log /var/log/nginx/zhyh_access.log main;
  114. # error_log /var/log/nginx/zhyh_error.log notice;
  115. # 客户端限制
  116. client_max_body_size 100M;
  117. # 禁止访问隐藏文件
  118. location ~ /\. {
  119. deny all;
  120. }
  121. }
  122. include /etc/nginx/conf.d/*.conf;
  123. include /etc/nginx/sites-enabled/*;
  124. }