NGINX to support websocket client on the same port
jebina
nginx-forum at forum.nginx.org
Wed Aug 31 05:21:13 UTC 2016
A quick question, Does Nginx support websocket client.
I have a webserver that uses NGINX and i use a websocket server for which
NGINX acts as proxy. In the same port , can i use websocket client to
initiate a connection with the external websocket server?
config is here
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;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server 192.168.5.16:8080;
}
server {
listen 9080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location /socket {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /test{
hello_world;
}
}
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,269299,269299#msg-269299
More information about the nginx
mailing list