v2ray.subdomain.conf.template 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # make sure that your dns has a cname set for homeassistant and that your homeassistant container is not using a base url
  2. server {
  3. listen 443 ssl fastopen=64 reuseport;
  4. server_name ${DOMAIN};
  5. # enable subfolder method reverse proxy confs
  6. # include /config/nginx/proxy-confs/*.subfolder.conf;
  7. # all ssl related config moved to ssl.conf
  8. include /config/nginx/ssl.conf;
  9. # enable for ldap auth
  10. #include /config/nginx/ldap.conf;
  11. client_max_body_size 0;
  12. proxy_buffer_size 128k;
  13. proxy_buffers 32 128k;
  14. proxy_busy_buffers_size 128k;
  15. proxy_headers_hash_bucket_size 128;
  16. proxy_headers_hash_max_size 1024;
  17. client_body_temp_path /tmp/nginx 1 2;
  18. proxy_temp_path /tmp/nginx-proxy;
  19. fastcgi_temp_path /tmp/nginx-fastcgi;
  20. uwsgi_temp_path /tmp/nginx-uwsgi;
  21. scgi_temp_path /tmp/nginx-scgi;
  22. location /${V2RAY_PATH} { # 与 V2Ray 配置中的 path 保持一致
  23. proxy_redirect off;
  24. proxy_pass http://10.10.0.2:10443;
  25. proxy_http_version 1.1;
  26. proxy_set_header Upgrade $http_upgrade;
  27. proxy_set_header Connection "upgrade";
  28. proxy_set_header Host $http_host;
  29. # Show realip in v2ray access.log
  30. proxy_set_header X-Real-IP $remote_addr;
  31. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  32. proxy_connect_timeout 60s;
  33. proxy_read_timeout 86400s;
  34. proxy_send_timeout 60s;
  35. }
  36. }
  37. server {
  38. listen 81 fastopen=64 reuseport;
  39. server_name ${DOMAIN};
  40. root /config/www;
  41. # enable subfolder method reverse proxy confs
  42. # include /config/nginx/proxy-confs/*.subfolder.conf;
  43. # all ssl related config moved to ssl.conf
  44. client_max_body_size 0;
  45. proxy_buffer_size 128k;
  46. proxy_buffers 32 128k;
  47. proxy_busy_buffers_size 128k;
  48. proxy_headers_hash_bucket_size 128;
  49. proxy_headers_hash_max_size 1024;
  50. client_body_temp_path /tmp/nginx 1 2;
  51. proxy_temp_path /tmp/nginx-proxy;
  52. fastcgi_temp_path /tmp/nginx-fastcgi;
  53. uwsgi_temp_path /tmp/nginx-uwsgi;
  54. scgi_temp_path /tmp/nginx-scgi;
  55. location /health {
  56. return 200 "ok";
  57. }
  58. location /${V2RAY_PATH} { # 与 V2Ray 配置中的 path 保持一致
  59. proxy_redirect off;
  60. proxy_pass http://10.10.0.2:10443;#假设WebSocket监听在环回地址的10000端口上
  61. proxy_http_version 1.1;
  62. proxy_set_header Upgrade $http_upgrade;
  63. proxy_set_header Connection "upgrade";
  64. proxy_set_header Host $http_host;
  65. # Show realip in v2ray access.log
  66. proxy_set_header X-Real-IP $remote_addr;
  67. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  68. proxy_connect_timeout 60s;
  69. proxy_read_timeout 86400s;
  70. proxy_send_timeout 60s;
  71. }
  72. location / {
  73. add_header Strict-Transport-Security "max-age=63072000; includeSubdomains;";
  74. proxy_redirect off;
  75. proxy_pass http://10.10.0.6:80;
  76. proxy_read_timeout 300;
  77. proxy_connect_timeout 300;
  78. proxy_set_header Host $http_host;
  79. proxy_set_header X-Real-IP $remote_addr;
  80. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  81. }
  82. }