nginx 配置: server { listen 80; server_name 服务器地址; charset utf-8; client_max_body_size 75M;
location / {
root /root/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
location /api/ {
uwsgi_pass 127.0.0.1:8001;
include /etc/nginx/uwsgi_params;
}
location /ws/ {
proxy_pass http://127.0.0.1:8001;
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;
}
} nginx 配置:
[uwsgi]
chdir = /root/....
home = /root/....
module = ....
master = True
processes = 2
harajiri = 60
max-requests = 5000
socket = 127.0.0.1:8001
uid = root
gid = root
pidfile = /root/master.pid
daemonize = /root/conf/logs/uwsgi_hzmj.log
vacuum = True
log-maxsize = 102400
buffer-size = 65536
websocket 报错:
WebSocket connection to 'ws://服务器地址 /ws/index/data/' failed: Error during WebSocket handshake: Unexpected response code: 502