aa 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. upstream backend {
  2. server andys-dandy-site-4c8fd6.webflow.io:443;
  3. }
  4. server
  5. {
  6. listen 80;
  7. listen 443 ssl http2 ;
  8. server_name pog.cxhy.cn;
  9. index index.php index.html index.htm default.php default.htm default.html;
  10. root /data/www/pog.cxhy.cn;
  11. #CERT-APPLY-CHECK--START
  12. # 用于SSL证书申请时的文件验证相关配置 -- 请勿删除
  13. include /www/server/panel/vhost/nginx/well-known/pog.cxhy.cn.conf;
  14. #CERT-APPLY-CHECK--END
  15. #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
  16. #error_page 404/404.html;
  17. ssl_certificate /www/server/panel/vhost/cert/pog.cxhy.cn/fullchain.pem;
  18. ssl_certificate_key /www/server/panel/vhost/cert/pog.cxhy.cn/privkey.pem;
  19. ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
  20. ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  21. ssl_prefer_server_ciphers on;
  22. ssl_session_cache shared:SSL:10m;
  23. ssl_session_timeout 10m;
  24. add_header Strict-Transport-Security "max-age=31536000";
  25. error_page 497 https://$host$request_uri;
  26. #SSL-END
  27. #ERROR-PAGE-START 错误页配置,可以注释、删除或修改
  28. #error_page 404 /404.html;
  29. #error_page 502 /502.html;
  30. #ERROR-PAGE-END
  31. location / {
  32. proxy_pass https://backend;
  33. proxy_set_header Host andys-dandy-site-4c8fd6.webflow.io;
  34. proxy_set_header X-Real-IP $remote_addr;
  35. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  36. proxy_set_header X-Forwarded-Proto $scheme;
  37. proxy_set_header X-Forwarded-Host $host;
  38. proxy_set_header X-Forwarded-Port $server_port;
  39. # 处理重定向,确保重定向后的URL仍然指向pog.lcxhy.cn
  40. proxy_redirect off;
  41. # 添加更多代理头,模拟真实浏览器
  42. proxy_set_header User-Agent $http_user_agent;
  43. proxy_set_header Accept $http_accept;
  44. proxy_set_header Accept-Language $http_accept_language;
  45. proxy_set_header Accept-Encoding $http_accept_encoding;
  46. proxy_set_header Connection "";
  47. # 内容替换 - 处理绝对路径和域名引用
  48. sub_filter 'https://andys-dandy-site-4c8fd6.webflow.io' 'https://pog.lcxhy.cn';
  49. sub_filter 'http://andys-dandy-site-4c8fd6.webflow.io' 'https://pog.lcxhy.cn';
  50. sub_filter '//andys-dandy-site-4c8fd6.webflow.io' '//pog.lcxhy.cn';
  51. sub_filter 'andys-dandy-site-4c8fd6.webflow.io' 'pog.lcxhy.cn';
  52. sub_filter_once off;
  53. sub_filter_types text/html text/css text/javascript application/javascript;
  54. # 处理JavaScript域名检测 - 注入修复脚本
  55. sub_filter '</head>' '<script>
  56. // 修复域名检测
  57. Object.defineProperty(window.location, "hostname", {
  58. get: function() { return "andys-dandy-site-4c8fd6.webflow.io"; }
  59. });
  60. Object.defineProperty(window.location, "host", {
  61. get: function() { return "andys-dandy-site-4c8fd6.webflow.io"; }
  62. });
  63. Object.defineProperty(window.location, "origin", {
  64. get: function() { return "https://andys-dandy-site-4c8fd6.webflow.io"; }
  65. });
  66. // 修复document.domain
  67. Object.defineProperty(document, "domain", {
  68. get: function() { return "andys-dandy-site-4c8fd6.webflow.io"; },
  69. set: function() { return "andys-dandy-site-4c8fd6.webflow.io"; }
  70. });
  71. </script></head>';
  72. # 可选:添加缓存控制
  73. proxy_cache_valid 200 1h;
  74. proxy_cache_valid 404 1m;
  75. # 处理超时
  76. proxy_connect_timeout 30s;
  77. proxy_send_timeout 30s;
  78. proxy_read_timeout 30s;
  79. }
  80. #一键申请SSL证书验证目录相关设置
  81. location ~ \.well-known{
  82. allow all;
  83. }
  84. access_log /www/wwwlogs/pog.cxhy.cn.log;
  85. error_log /www/wwwlogs/pog.cxhy.cn.error.log;
  86. }