2022-08-29 15:17:11 +00:00
|
|
|
server {
|
|
|
|
listen 443 ssl http2;
|
2023-12-04 09:51:17 +00:00
|
|
|
listen [::]:443 ssl http2;
|
2022-08-29 15:17:11 +00:00
|
|
|
server_name example.com;
|
|
|
|
|
|
|
|
index index.html;
|
|
|
|
root /var/www/html;
|
2023-01-23 11:59:09 +00:00
|
|
|
ssl on;
|
2022-08-29 15:17:11 +00:00
|
|
|
ssl_certificate /path/to/example.cer;
|
|
|
|
ssl_certificate_key /path/to/example.key;
|
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
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;
|
|
|
|
|
|
|
|
# 在 location 后填写 /你的 path
|
|
|
|
location /你的 path {
|
2022-08-29 16:23:48 +00:00
|
|
|
if ($http_upgrade != "websocket") {
|
|
|
|
return 404;
|
|
|
|
}
|
2023-01-23 11:59:09 +00:00
|
|
|
proxy_pass http://127.0.0.1:1234;
|
2022-08-29 16:23:48 +00:00
|
|
|
proxy_redirect off;
|
2022-08-29 15:17:11 +00:00
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2023-12-04 09:42:52 +00:00
|
|
|
proxy_read_timeout 5d;
|
2022-08-29 15:17:11 +00:00
|
|
|
}
|
2022-08-29 15:29:29 +00:00
|
|
|
}
|