Answer the question
In order to leave comments, you need to log in
How to configure nginx under websocket from ws to wss?
I now have the following settings
in the /etc/nginx/sites-available/websocket file
server {
listen 443 ssl;
server_name socket.example.com;
error_page 404 /;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_pass http://localhost:1000;
}
ssl_certificate /etc/letsencrypt/live/socket.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/socket.example.com/privkey.pem; # managed by Certbot
}
Answer the question
In order to leave comments, you need to log in
It won't work since nginx is http/s, not ws/wss.
Configure your application itself to work on wss or the client must understand that it works via https on wss.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question