Laravel reverb process server running but upstream connection failing

server {
    listen 8080;
    listen [::]:8080;

    server_name ws.domain.com;

    location / {
        proxy_http_version 1.1;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_pass http://127.0.0.1:6060;
    }
}

server {
...
[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = 'stop'
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[[services]]
  internal_port = 6060
  processes = ["reverb"]

[processes]
  app = ""
  queue = "php artisan queue:listen"
  reverb = "php artisan reverb:start"
  schedule = "cron -f"

I’m experiencing an issue with my Nginx reverse proxy setup on Fly.io. Here’s the situation:

  1. My server log shows a successful start:
INFO  Starting server on 0.0.0.0:6060
  1. Running ss -tuln confirms that it’s correctly listening on 0.0.0.0:6060.
  2. However, when I try to access ws.domain.com, I get the following error:
[error] 342#342: *27 connect() failed (111: Unknown error) while connecting to upstream, client: 172.16.0.106, server: ws.domain.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:6060/", host: ws.domain.com

It seems that while the server is running and listening on the correct port, Nginx is unable to establish a connection to the upstream server.

What could be causing this issue, and what steps should I take to troubleshoot and resolve it? Any help or suggestions would be greatly appreciated.