nginx.conf 967 B

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