map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream swoole { server 10.22.22.2:20000 weight=5 max_fails=3 fail_timeout=30s; keepalive 16; } server { listen 80; include /etc/nginx/conf.d/site/*.conf; root /var/www/public; client_max_body_size 200M; autoindex off; index index.html index.htm index.php; charset utf-8; location / { try_files $uri @laravels; } location ~ \.well-known{ allow all; } location =/ws { proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-PORT $remote_port; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header Scheme $scheme; proxy_set_header Server-Protocol $server_protocol; proxy_set_header Server-Name $server_name; proxy_set_header Server-Addr $server_addr; proxy_set_header Server-Port $server_port; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_pass http://swoole; } location @laravels { proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-PORT $remote_port; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header Scheme $scheme; proxy_set_header Server-Protocol $server_protocol; proxy_set_header Server-Name $server_name; proxy_set_header Server-Addr $server_addr; proxy_set_header Server-Port $server_port; proxy_pass http://swoole; } } include /etc/nginx/conf.d/conf.d/*.conf;