您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

88 行
2.5 KiB

  1. # HTTP -> HTTPS 强制跳转
  2. server {
  3. listen 80;
  4. server_name m.cytx.csybhelp.com;
  5. # ACME HTTP-01 验证路径放行
  6. location /.well-known/acme-challenge/ {
  7. root /home/acme-challenge;
  8. }
  9. # HTTP 跳转 HTTPS
  10. location / {
  11. rewrite ^(.*)$ https://$server_name$1 permanent;
  12. }
  13. }
  14. # HTTPS
  15. server {
  16. listen 443 ssl;
  17. http2 on;
  18. server_name m.cytx.csybhelp.com;
  19. access_log /home/wwwlogs/m_cytx_csybhelp_com_access.log;
  20. error_log /home/wwwlogs/m_cytx_csybhelp_com_error.log;
  21. ssl_certificate cert/m_cytx_csybhelp_com_fullchain.pem;
  22. ssl_certificate_key cert/m_cytx_csybhelp_com_privkey.pem;
  23. # Gzip
  24. gzip on;
  25. gzip_vary on;
  26. gzip_min_length 1024;
  27. gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript;
  28. # H5 前端(history 模式)
  29. location / {
  30. root /home/www/cytx_h5_html/;
  31. index index.html index.htm;
  32. try_files $uri $uri/ /index.html;
  33. client_max_body_size 100m;
  34. proxy_connect_timeout 300s;
  35. proxy_send_timeout 300s;
  36. proxy_read_timeout 300s;
  37. add_header Cache-Control no-cache;
  38. add_header Access-Control-Allow-Credentials true;
  39. add_header Access-Control-Allow-Origin $http_origin;
  40. add_header Access-Control-Allow-Headers $http_access_control_request_headers;
  41. }
  42. # H5 API 代理(/pro-api -> Node,去掉前缀)
  43. location /pro-api/ {
  44. rewrite ^/pro-api/(.*)$ /$1 break;
  45. proxy_pass http://127.0.0.1:8361;
  46. proxy_set_header X-Real-IP $remote_addr;
  47. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  48. proxy_set_header X-Forwarded-Proto $scheme;
  49. proxy_set_header Host $http_host;
  50. proxy_set_header X-NginX-Proxy true;
  51. proxy_set_header Upgrade $http_upgrade;
  52. proxy_set_header Connection "upgrade";
  53. }
  54. # API 直接代理(/api -> Node)
  55. location /api/ {
  56. proxy_pass http://127.0.0.1:8361;
  57. proxy_set_header X-Real-IP $remote_addr;
  58. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  59. proxy_set_header X-Forwarded-Proto $scheme;
  60. proxy_set_header Host $http_host;
  61. proxy_set_header X-NginX-Proxy true;
  62. proxy_set_header Upgrade $http_upgrade;
  63. proxy_set_header Connection "upgrade";
  64. }
  65. # Nginx 状态
  66. location /nginx_status {
  67. stub_status on;
  68. access_log off;
  69. }
  70. # 隐藏文件
  71. location ~ /\. {
  72. #deny all;
  73. }
  74. }