1

Here's the config file in /etc/nginx/sites-available

server {

    server_name my.app;

    location / {
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $http_host;
    proxy_pass http://127.0.0.1:8545;
    }

    location /ws {
    proxy_pass http://127.0.0.1:8546;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 86400;
  }

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/my.app/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/my.app/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

The https works fine. Getting 1006 connection failed error when trying to connect via wss://my.app/ws Configurations permissions are set to 777, and the port 8546 is listening on netstat -l

And if i open port 8546 I can use ws://my.app:8546 just fine.

Some documents already looked at... NGINX to reverse proxy websockets AND enable SSL (wss://)?

Ya Wang
  • 1,758
  • 1
  • 19
  • 41

0 Answers0