nginx.conf 994 B

1234567891011121314151617181920212223242526272829
  1. server {
  2. listen 443 ssl http2;
  3. listen [::]:443 ssl http2;
  4. server_name example.com;
  5. index index.html;
  6. root /var/www/html;
  7. ssl on;
  8. ssl_certificate /path/to/example.cer;
  9. ssl_certificate_key /path/to/example.key;
  10. ssl_protocols TLSv1.2 TLSv1.3;
  11. 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;
  12. # 在 location 后填写 /你的 path
  13. location /你的 path {
  14. if ($http_upgrade != "websocket") {
  15. return 404;
  16. }
  17. proxy_pass http://127.0.0.1:1234;
  18. proxy_redirect off;
  19. proxy_http_version 1.1;
  20. proxy_set_header Upgrade $http_upgrade;
  21. proxy_set_header Connection "upgrade";
  22. proxy_set_header Host $host;
  23. proxy_set_header X-Real-IP $remote_addr;
  24. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  25. proxy_read_timeout 5d;
  26. }
  27. }