Nginx load balancer websocket issue -
i'm new in nginx , websocket systems per project requirements need check complex things finish.
i'm trying create 1 example using nginx, handles websocket (port: 1234) , http requests (port: 80) using same url (load balancer url).
i'm using 3 nginx server, 1 load balancer (10.0.0.163) , other 2 application server have installed real apis, 10.0.0.152 , 10.0.0.154 respectively. right now, have configured websocket on application servers.
as per above configuration, requests pass on 10.0.0.163 (load balancer) , it's proxy setting pass request (http/websocket) application server (10.0.0.152/154).
note : each application server contain separate nginx, php, websocket
here default (location : /etc/nginx/sites-available/) file 10.0.0.154 server, handles websocket , http requests on same domain.
server{ listen 80; charset utf-8; root /var/www; index index.html index.htm index.php server_name localhost 10.0.0.154 ; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } location / { try_files $uri $uri/ @proxy; autoindex on; } location @proxy{ proxy_pass http://wb1; } location =/ { proxy_pass http://wb; proxy_http_version 1.1; proxy_buffers 8 16k; proxy_buffer_size 32k; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; proxy_set_header host $host; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header referer $http_referer; proxy_redirect off; } }
following default file (location : /etc/nginx/sites-available/) load balancer @ 10.0.0.163.
upstream wb{ server 10.0.0.154; server 10.0.0.152; } server{ listen 80; charset utf-8; root /var/www; index index.html index.htm index.php server_name 10.0.0.163 ; location / { try_files $uri $uri/ @proxy; autoindex on; } location @proxy{ proxy_pass http://wb; } location =/ { proxy_pass http://wb; proxy_http_version 1.1; proxy_buffers 8 16k; proxy_buffer_size 32k; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; proxy_set_header host $host; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header referer $http_referer; proxy_redirect off; } }
i found that, load balancer working http requests it's unable proceed websocket requests application server.
i don't know i'm missing here .. if guys can me out great appriciate
i seen configuration looks proper. think should check load balancer & application server configuration or versions. maybe problem of incompatibility.
Comments
Post a Comment