个人的 nginx 配置如下:
upstream websocket {
server 127.0.0.1:10300;
server 127.0.0.1:10301;
server 127.0.0.1:10302;
}
server {
listen 80;
client_max_body_size 4G;
access_log /home/work/logs/nginx_access.log;
error_log /home/work/logs/nginx_error.log;
# 域名
server_name www.example.com;
add_header X-UA-Compatible "IE=edge,chrome=1"; # IE 用最新内核渲染页面
location / {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_redirect default;
add_header "Access-Control-Allow-Origin" "*";
add_header "Access-Control-Allow-Credentials" "true";
add_header "Access-Control-Allow-Headers" "X-Requested-With";
}
}
1
tz1006 2018-11-01 05:00:40 +08:00
对 Nginx 不精通,
两个建议 1. 有可能是缓存, 配置文件还有从别的地方导入的,你上面没贴出缓存相关的配置。 2. 尝试使用最新版本或者稳定版本的 Nginx。 |