server { listen 80; listen [::]:80; listen 20757; listen [::]:20757; server_name us4.i1.hdslb.com; server_name i1.hdslb.com; root /var/www/html; index index.html index.htm index.nginx-debian.html; location / { # gzip off; # fastcgi_pass unix:/var/run/fcgiwrap.socket; # fastcgi_param SCRIPT_FILENAME /usr/local/bin/speedtest.sh; # include fastcgi_params; } location /m { # Check if the connection is a WebSocket upgrade request if ($http_upgrade !~* "websocket") { return 404; } proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; } } server { listen 443 ssl http2; listen [::]:443 ssl http2; listen 8443 ssl http2; listen [::]:8443 ssl http2; server_name us4.zhihubaiduxiaohongshu.top; root /var/www/html; index index.html index.htm index.nginx-debian.html; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } location /m { if ($http_upgrade !~* "websocket") { return 404; } proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host "i1.hdslb.com"; } ssl_certificate /etc/letsencrypt/live/zhihubaiduxiaohongshu.top/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/zhihubaiduxiaohongshu.top/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; }