nginx 配置 ,如果不想另开端口,可以加一个目录指向,比如wsapp,但是这个目录必须是存在的,
- map $http_upgrade $connection_upgrade {
- default upgrade;
- ” close;
- }
- upstream websocket {
- server 192.168.100.10:8010;
- }
- server {
- listen 80;
- location /wsapp {
- proxy_pass http://websocket;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection “Upgrade”;
- }
- }