Hello,
I’m installing n8n with Docker on a Hostinger VPS KVM2 using Ubuntu 22.04 LTS. I’ve been trying to find a solution for a few days, but I keep getting the “Disconnected” error when connecting to the domain address. I’ve listed all the steps I’ve tried to resolve this issue below.
Server and Installation Details:
VPS Provider: Hostinger VPS KVM2
Operating System: Ubuntu 22.04 LTS
Installation: The latest version of n8n (latest) with Docker Compose
Steps I’ve Followed (All steps failed):
Port Permissions:
At first, I received the “Connection refused” error.
I added the line ports: - “5678:5678” to the docker-compose.yml file.
This made n8n accessible locally, but the 502 Bad Gateway error persisted.
Folder Permissions:
I noticed that n8n was constantly restarting. The logs showed the error EACCES: permission denied.
I stopped n8n using the docker-compose down command.
I corrected the ownership of the data folder using the command sudo chown -R 1000:1000 ./n8n-data.
I restarted n8n using docker-compose up -d. Now n8n was working fine.
Nginx and Firewall:
I configured Nginx and the firewall to resolve the 502 Bad Gateway and Connection lost errors.
Nginx: I created a reverse proxy configuration that will redirect incoming HTTP traffic to HTTPS and forward HTTPS traffic to http://localhost:5678.
Firewall: I opened ports 80, 443, and 5678 for TCP in my Hostinger control panel.
DNS: I made sure my domain name is pointing to the correct IP address of my VPS.
However, the problem still persists.
Result and Request for Help:
When I run the docker-compose ps command over SSH, I see that n8n is in an Up state. Memory and CPU usage are also normal. Even though all my configuration steps appear correct, I’m still getting a “Connection lost” error, which has me stuck.
Has anyone encountered a similar issue or can help me with this? What steps might I have missed?
docker-compose.yml version: ‘3.8’ services: n8n: image: n8nio/n8n:1.97.0 container_name: n8n restart: always ports: - “5678:5678” environment: - N8N_HOST=${N8N_HOST} - N8N_PROTOCOL=https - N8N_PORT=5678 - N8N_BASIC_AUTH_ACTIVE=false - NODE_ENV=production volumes: - ./n8n-data:/home/node/.n8n
Nginx Configuration File server { listen 80; server_name DOMAIN; return 301 https://$host$request_uri; } server { listen 443 ssl http2; server_name DOMAIN; ssl_certificate /etc/letsencrypt/live/DOMAIN/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/DOMAIN/privkey.pem; location / { proxy_pass http://localhost:5678; 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; } }