#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream webSockerNginx {
ip_hash;
server 172.16.55.62:8081 weight=10;
server 192.168.8.23:8083 weight=10;
}
server {
listen 8080;
server_name webSockerNginxServer;
location / {
#支持websocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#解决 前端403问题
proxy_set_header Origin "";
#解决IP问题
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $pr
nginx websocket ip_hash规则
最新推荐文章于 2024-07-22 13:11:05 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)