W
W
webivan12016-12-28 16:31:47
Debian
webivan1, 2016-12-28 16:31:47

How to correctly register a proxy for ws?

I have a VPS (Debian) installed vestacp apache 2.4 / nginx I'm making a
websocket chat site, everything works great.
I decided to install SSL and websockets are down, there is no connection to wss,
How to correctly register a proxy for sockets through ws, that is, proxy wss to ws
For example, I have several servers with websockets busy on ports 8885 - 8889
wss://site.ru: 8885 => ws://site.ru:8885 how it will look on nginx and apache (in case it doesn't work on nginx)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Valle, 2017-01-04
@webivan1

upstream backend {
server site.ru:8889;
}
server {
listen 8885;
server_name site.ru;
ssl on;
ssl_certificate /path/to/cert;
ssl_certificate_key /path/to/key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
location / {
proxy_pass http://backend;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question