VPS - Docker - Serverpilot | Connection lost

Hi,

I really hope someone can help me as I already tried all kind of configs I found in the forum.

My setup:
VPS
Docker
N8N
NGINX (configured by ServerPilot)

My config looks like:
docker_compose.yml:

version: "3.8"

services:
  n8n:
    image: n8nio/n8n:1.94.0
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=automation.mydomain.at
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - N8N_EDITOR_BASE_URL=https://automation.mydomain.at
      - WEBHOOK_TUNNEL_URL=https://automation.mydomain.at
      - N8N_PUSH_BACKEND=websocket    
      - N8N_BASIC_AUTH_ACTIVE=false
      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
      - N8N_RUNNERS_ENABLED=true
      - VUE_APP_URL_BASE_API="https://automation.mydomain.at"
    volumes:
      - ./n8n-data:/home/node/.n8n

my nginx-app.conf.erb (overrides the vhosts):

server {
    server_name automation.mydomain.at;

    location / {
        proxy_pass http://127.0.0.1:5678;
        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_buffering off;
        chunked_transfer_encoding off;
        proxy_cache off;
    }
}

When i open n8n I see this error and can not run my automations:

I already tried several different configs found on the forum but nothing helped so far. Also tried to downgrade → Same. It probably has something to do with nginx but I’m not sure how to dig deeper.

Really appreaciate your feedback.

Thanks and BR from Austria,
Niko

are the logs clear. don’t you see the error info in the logs?

which error logs are the most interesting? I will provide them of course. Sorry, I’m not super familiar with servers.

p.s.: nginx error log ist leer.
docker compose log auch ohne nennenswerte fehler (läuft ja theoretisch auch - also ist ja über den browser aufrufbar)

docker logs -f container id. should show any issues



root@v220241254037301857:/srv/users/dotfox/apps/n8n/public/docker-n8n# docker-compose logs -f n8n
n8n-1  | User settings loaded from: /home/node/.n8n/config
n8n-1  | Initializing n8n process
n8n-1  | n8n ready on ::, port 5678
n8n-1  | n8n Task Broker ready on 127.0.0.1, port 5679
n8n-1  | [license SDK] Skipping renewal on init because renewal is not due yet or cert is not initialized
n8n-1  | Registered runner "JS Task Runner" (tSeYXSbx2MCSo1NKRymoD)
n8n-1  | Version: 1.98.1
n8n-1  |
n8n-1  | Editor is now accessible via:
n8n-1  | https://automation.mydomain.at




That looks pretty much OK, or not?

ya , looks ok. how about access logs and error logs

/srv/users/serverpilot/log/automation.mydomain.at/access.log

tail -f /srv/users/serverpilot/log/automation.mydomain.at/error.log

Thanks a lot for your help so far. here are the anonimized log files.

  1. n8n_nginx.access_ssl.log: [cite_start][ANONYMIZED_IP] - - [16/Jun/2025:14:15:00 +0200] "GET /signin?redire - Pastebin.com
  2. n8n_php8.4.access.log: [ipv6] - [16/Jun/2025:12:57:29 +0200] "GET /index.php" 200 0 - 2962603 2964056 0 - Pastebin.com
  3. n8n_apache.error.log: [Mon Jun 16 13:57:04.480736 2025] [autoindex:error] [pid 2965411:tid 2965413] [c - Pastebin.com
  4. n8n_nginx.access.log: [ipv6] - - [16/Jun/2025:12:57:29 +0200] "GET / HTTP/1.1" 200 463 "-" "Mozilla/5. - Pastebin.com

The most intersting one is probably: the n8n_apache.error.log. Here are some lines (full code above):

[Mon Jun 16 15:50:26.631283 2025] [proxy:error] [pid 2990995:tid 2991019] [client [ipv6]] AH00898: Error reading from remote server returned by /workflow/2kkK2wyF5T4o5ZH9
[Mon Jun 16 16:29:48.039887 2025] [proxy_http:error] [pid 2990995:tid 2991001] (104)Connection reset by peer: [client [ipv6]] AH01102: error reading status line from remote server 127.0.0.1:5678
[Mon Jun 16 16:29:48.039948 2025] [proxy:error] [pid 2990995:tid 2991001] [client [ipv6]] AH00898: Error reading from remote server returned by /rest/push
[Mon Jun 16 16:35:36.597509 2025] [proxy_http:error] [pid 2990995:tid 2991002] (104)Connection reset by peer: [client [ipv6]] AH01102: error reading status line from remote server 127.0.0.1:5678
[Mon Jun 16 16:35:36.597570 2025] [proxy:error] [pid 2990995:tid 2991002] [client [ipv6]] AH00898: Error reading from remote server returned by /workflow/2kkK2wyF5T4o5ZH9
[Mon Jun 16 16:35:37.821642 2025] [proxy_http:error] [pid 2990825:tid 2990885] (104)Connection reset by peer: [client [ipv6]] AH01102: error reading status line from remote server 127.0.0.1:5678
[Mon Jun 16 16:35:37.821680 2025] [proxy:error] [pid 2990825:tid 2990885] [client [ipv6]] AH00898: Error reading from remote server returned by /workflow/2kkK2wyF5T4o5ZH9
[Mon Jun 16 16:45:08.830810 2025] [proxy_http:error] [pid 2990836:tid 2990903] (104)Connection reset by peer: [client [ipv6]] AH01102: error reading status line from remote server 127.0.0.1:5678
[Mon Jun 16 16:45:08.830866 2025] [proxy:error] [pid 2990836:tid 2990903] [client [ipv6]] AH00898: Error reading from remote server returned by /rest/push
[Mon Jun 16 16:55:11.926284 2025] [proxy:error] [pid 2990995:tid 2991016] (111)Connection refused: AH00957: http: attempt to connect to 127.0.0.1:5678 (127.0.0.1:5678) failed
[Mon Jun 16 16:55:11.926362 2025] [proxy_http:error] [pid 2990995:tid 2991016] [client [ipv6]] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
[Mon Jun 16 16:55:27.851194 2025] [proxy:error] [pid 2990995:tid 2991009] (111)Connection refused: AH00957: http: attempt to connect to 127.0.0.1:5678 (127.0.0.1:5678) failed
[Mon Jun 16 16:55:27.851235 2025] [proxy_http:error] [pid 2990995:tid 2991009] [client [ipv6]] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
[Mon Jun 16 16:55:43.959180 2025] [proxy:error] [pid 2990995:tid 2991015] (111)Connection refused: AH00957: http: attempt to connect to 127.0.0.1:5678 (127.0.0.1:5678) failed
[Mon Jun 16 16:55:43.959214 2025] [proxy_http:error] [pid 2990995:tid 2991015] [client [ipv6]] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
[Mon Jun 16 17:18:07.979032 2025] [proxy_http:error] [pid 2990995:tid 2991002] (104)Connection reset by peer: [client [ipv6]] AH01102: error reading status line from remote server 127.0.0.1:5678
[Mon Jun 16 17:18:07.979108 2025] [proxy:error] [pid 2990995:tid 2991002] [client [ipv6]] AH00898: Error reading from remote server returned by /rest/push

Looks like a proxy error but I dont know how to solve it? hmmm…

Check if n8n is actually listening on 127.0.0.1:5678 or 0.0.0.0:5678:

docker inspect <container_id> | grep -i “IPAddress”
or
ss -tulnp | grep 5678

If it’s not on 127.0.0.1, update your NGINX config to reflect the actual internal IP.

(post deleted by author)

(post deleted by author)

Not sure why my reply with the output was flagged and removed because it was anonymized but however.

I removed the rest of the output:

v220241254037301857:~# 6
tcp liste      127.0.0.1:5678       0.0.0.0:*                                                        

(post deleted by author)

(post deleted by author)

Seems your NGINX outside docker? Please confirm . if yes better put it inside.

before that try this

Update your docker-compose.yml ports to:

ports:

  • “0.0.0.0:5678:5678”

then restart docker
docker-compose down
docker-compose up -d

and check

Yes, NGINX is running outside of docker because it’s controlled / configured by Serverpilot. I actually already thought about dumping Serverpilot - I think the setup together with Docker is not really optimal.

I updated my docker-compose.yml it now looks like (I have updated a few other settings too, thats why I post the complete config. Just to be sure):

version: "3.8"

services:
  n8n:
    image: n8nio/n8n:1.98.1  # tried older versions
    restart: always
    ports:
      - "0.0.0.0:5678:5678"   # tried different options like 127.0.0.1:5678 localhost:5678:5678
    environment:
      - N8N_HOST=0.0.0.0 # tried 127.0.0.1
      - N8N_PORT=5678
      - N8N_PROTOCOL=http          #already tried with https too - doesnt make difference
      - N8N_TRUST_PROXY=true       # tried with and without
      - N8N_EDITOR_BASE_URL=https://automation.mydomain.at/
      - WEBHOOK_TUNNEL_URL=https://automation.mydomain.at/
      - WEBHOOK_URL=https://automation.mydomain.at/
      - VUE_APP_URL=https://automation.mydomain.at   #can be removed?
      - N8N_API_URL=https://automation.mydomain.at/
      - N8N_DIAGNOSTICS_ENABLED=true
      - N8N_EXECUTIONS_MODE=regular
      - N8N_RUNNERS_ENABLED=true
      - N8N_PUSH_BACKEND=websocket
      - GENERIC_TIMEZONE=Europe/Berlin
      - TZ=Europe/Berlin
    volumes:
      - ./n8n-data:/home/node/.n8n
      
      

WOHOOOOOOOO - I made it.

I created a new file “websockets.ssl_conf” in “/etc/nginx-sp/vhosts.d/n8n.d”

location /rest/ {
    proxy_pass http://127.0.0.1:5678;
    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_read_timeout 600s;
    proxy_send_timeout 600s;
    proxy_buffering off;
    chunked_transfer_encoding off;
    proxy_cache off;
}

(location /rest/ was important!)

restarted NGINX. And thats it.

The main issue was, that the config, which i had before, was not applied somehow.

I REALLY APPRECIATE your help and the effort you put in!!

1 Like

Great !!.. and I suggest putting NGINX inside the docker if there are further issue . Its easy to manage there with the default network applied.

1 Like