nginx_proxy.conf 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. server {
  2. listen 443 ssl;
  3. listen [::]:443 ssl;
  4. ssl_certificate /etc/v2ray/v2ray.crt;
  5. ssl_certificate_key /etc/v2ray/v2ray.key;
  6. ssl_session_timeout 1d;
  7. ssl_session_cache shared:MozSSL:10m;
  8. ssl_session_tickets off;
  9. ssl_protocols TLSv1.2 TLSv1.3;
  10. ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
  11. ssl_prefer_server_ciphers off;
  12. server_name mydomain.me;
  13. location /michi/Tun { # This michi shall in consistent with the grpc serviceName in v2ray config.json
  14. if ($request_method != "POST") { # if the request method is not POST for this location, return 404
  15. return 404;
  16. }
  17. grpc_socket_keepalive on;
  18. grpc_intercept_errors on;
  19. grpc_pass grpc://127.0.0.1:12345; # presume v2ray is listening on port 12345
  20. grpc_set_header Upgrade $http_upgrade;
  21. grpc_set_header Connection "upgrade";
  22. grpc_set_header Host $host;
  23. # Show real IP in v2ray access.log
  24. grpc_set_header X-Real-IP $remote_addr;
  25. grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  26. }
  27. }