server { #下面这个部分和正常配置 https 没有什么区别 listen 443; server_name www.hgos.top; ssl on; #申请域名对应的证书 ssl_certificate C:/BtSoft/nginx/conf/ssl/www.hgos.top/fullchain.pem; ssl_certificate_key C:/BtSoft/nginx/conf/ssl/www.hgos.top/privkey.pem; ssl_session_timeout 5m; ssl_session_cache shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2 SSLv2 SSLv3; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; ssl_prefer_server_ciphers on; ssl_verify_client off; #反向代理 需要把后续.php相关的和重写index.php的部分删除 location / { proxy_redirect off; proxy_pass http://127.0.0.1:8081; #转发到你本地的9501端口 对应 ws 的端口 proxy_set_header Host $host; proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr:$remote_port; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection upgrade; } }