Need to make a WebSocket over SSL i. WSS.

It was possible to start the server on the site without a certificate, the test chat works (the Ratchet library), but I do the same on the site where the certificate is located, of course it does not establish a connection.

As I understand it is necessary to make a proxy through Nginx (installed), through which the connection will pass.

I have a VDS server with ISP Manager installed

How to write configs?

Here, the answer seems to be similar to what is needed, but where can I get http {} to insert I don’t have it ...

Again, it is not clear, there are no clear / understandable answers at all ...

Please help is very necessary ...

  • Read on nginx.ru, there is about it; also http {} this is for the nginx.conf file - Daniel Protopopov
  • @DanielProtopopov about http {} there’s no such thing, do I need to add it? - Alexander Sizintsev
  • Everything is there, learn to read the documentation - nginx.org/ru/docs/beginners_guide.html#conf_structure - Daniel Protopopov
  • @DanielProtopopov in the main file is, in the configuration files for each individual domain is not. - Alexander Sizintsev
  • @DanielProtopopov I reinsure, since the first time I come across this, I would not want to break it - Alexander Sizintsev

2 answers 2

Design

map $http_upgrade $connection_upgrade { default upgrade; '' close; } 

prescribed in the /etc/nginx/nginx.conf file in the http {} section

We read the source for enlightenment.

  • I read it ... did not really understand - Alexander Sizintsev
  • I added this to /etc/nginx/nginx.conf, and here's where to configure another part of this proxy, I understand location / ws / {...} to insert into server {} already in the nginx settings of the site itself in the block that works through certificates . But here's how to set up exactly on port 4444 as the websocket works on it - Alexander Sizintsev

He suffered for a long time and asked many questions here, but he didn’t suggest how he decided to do it himself, the answer here