0

Triying to setup ssl for laravel reverb using nginx on ubuntu

Laravel reverb docs

/etc/supervisor/conf.d/websockets.conf

[program:websockets-l11]
command=/usr/bin/php /var/www/l11/artisan reverb:start
numprocs=1
autostart=true
autorestart=true
user=ubuntu

Nginx

server {
    root /var/www/l11/public;
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";
    index index.php;
    server_name l11.example.com;
    charset utf-8;
 
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }
    error_page 404 /index.php;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
    
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location /websocket {
        proxy_http_version 1.1;
        proxy_set_header Host $http_host;
        proxy_set_header Scheme $scheme;
        proxy_set_header SERVER_PORT $server_port;
        proxy_set_header REMOTE_ADDR $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
 
        proxy_pass http://0.0.0.0:8080;
    }

    listen 80; # managed by Certbot
    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/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

}

echo-bLibrbhu.js:8 WebSocket connection to 'wss://l11.example.com:8080/app/lkak9yjwbphvj8kwlzav?protocol=7&client=js&version=8.4.0-rc2&flash=false' failed

6
  • You configured the websocket for /ws but the client is not using that path. Commented Mar 14 at 17:38
  • What will be the correct path? y try with /websocket but get same error Commented Mar 14 at 18:03
  • According to the error message your client accesses /app. Commented Mar 14 at 18:59
  • Thank you, changing path and reverb port to 443 works! Commented Mar 14 at 19:32
  • 1
    Hi where do you change the path ? Commented Mar 20 at 7:13

0

You must log in to answer this question.

Browse other questions tagged .