Installing n8n selfhositing

I installed my n8n using this guide below on a vm running Ubuntu 24.04 and after installing it with docker the webpage is not showing up.
https://contabo.com/blog/self-hosting-n8n-a-comprehensive-docker-vps-guide/

docker compose logs -f n8n does not come up with any errors and says its running on port 5678

Share the output returned by the last node

Information on your n8n setup

  • n8n version:1.121.3
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker):
  • Operating system: Ubuntu 24.04

You have followed all the steps in the guide including the NGINX configuration, correct? if that’s true can you share your website url or try to access your website from a different browser?

Hi, which errors do you see in the ‘DevTools’ → ‘Console’ tab in your browser?

Nothing comes up.

NGINX config is correct its just not loading n8n even though docker says its up.

You need to see what happens on the Nginx side of things:

sudo tail -f /var/log/nginx/access.log

Try that and take a look. What error codes are you seeing? 502, 400, 404?

Try to take a look here as well:

sudo tail /var/log/nginx/error.log

Also take a look at the dev tools console from your browser (as suggested by another user). There will be a useful error message somewhere.

Khem

Access logs look fine but there is errors logs

root@n8n:~# sudo tail /var/log/nginx/error.log
2025/11/29 02:32:40 [notice] 10338#10338: using inherited sockets from “5;6;”
2025/11/30 13:53:02 [error] 10598#10598: *404 client intended to send too large body: 10485761 bytes, client: 195.170.172.128, server: _, request: “POST / HTTP/1.1”, host: “ip here ”

Hello,

Seems you found the root cause.

From what I understand on this log, nginx has a size limit for request. Your request is a bit too big.

Can you try to edit this settings in your nginx config ?

client_max_body_size XX M;

Maybe like

client_max_body_size 20M; 

Still no good, I tried to pull logs and I still see access logs but now there’s no errors.

it’s most likely not the max body size issue. What you’re seeing in the error.log may have come from some other request by you or someone else. I got to see the domain from your logs.

The problem is when the redirect to https happens. It turns out that port 443 may not be open on the server. You can try netcat or curl to see. This will hang: curl -v https://n8n.aidanwilliams.xyz

My money is on it not being open. Try to open 443 up. I don’t want to do a port scan on the server, but most likely not see 443 open.

Khem

I went to check again and I opened the port to 433 instead of 443 :man_facepalming:

One last thing, when I go to the workflow it will say connection lost, how can I fix this because how can the connection be lost if Im literally on the web and the server is up and running

image

Docker logs

2025-12-01T21:55:17.919Z [Rudder] error: Response error status: 403
n8n-1 | Response error code: ERR_BAD_REQUEST
n8n-1 | 2025-12-01T21:55:18.019Z [Rudder] error: Error: Forbidden
n8n-1 | Request failed with status code 403
n8n-1 | 2025-12-01T21:55:59.570Z [Rudder] error: Response error status: 403
n8n-1 | Response error code: ERR_BAD_REQUEST
n8n-1 | 2025-12-01T21:55:59.571Z [Rudder] error: Error: Forbidden
n8n-1 | Request failed with status code 403
n8n-1 | 2025-12-01T21:56:51.359Z [Rudder] error: Response error status: 403
n8n-1 | Response error code: ERR_BAD_REQUEST
n8n-1 | 2025-12-01T21:56:51.361Z [Rudder] error: Error: Forbidden
n8n-1 | Request failed with status code 403
n8n-1 | 2025-12-01T21:57:19.607Z [Rudder] error: Response error status: 403
n8n-1 | Response error code: ERR_BAD_REQUEST
n8n-1 | 2025-12-01T21:57:19.608Z [Rudder] error: Error: Forbidden
n8n-1 | Request failed with status code 403
n8n-1 | [license SDK] license successfully renewed

Console log of the web

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:5678/rest/telemetry/proxy/v1/track. (Reason: CORS request did not succeed). Status code: (null). 4

Glad that you got past the hanging issue by opening 443 up. Now, you’re seeing CORS issue.

What does your docker-compose look like? In particular, what do you have for: N8N_HOST, WEBHOOK_URL

Khem

I currently have it as the website link

 - N8N_HOST=n8n.aidanwilliams.xyz
 - WEBHOOK_URL=https://n8n.aidanwilliams.xyz/

restart: always
ports:
  - "127.0.0.1:5678:5678"
environment:
  - DB_TYPE=postgresdb
  - DB_POSTGRESDB_HOST=postgres
  - DB_POSTGRESDB_PORT=5432
  - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
  - DB_POSTGRESDB_USER=${POSTGRES_USER}
  - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
  - N8N_HOST=n8n.aidanwilliams.xyz
  - WEBHOOK_URL=https://n8n.aidanwilliams.xyz/

If you’re visiting https://n8n.aidanwilliams.xyz/ and it’s giving you that CORS error. The issue may be the docker-compose.yml and/or the nginx configuration. I would first give docker a kick with: docker compose up -d

I use nginx as well. I have the following. Maybe try to add the forwarding headers:

        #  Standard Proxy Headers
        proxy_http_version 1.1;
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;

        # Forwarding Headers
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;

I don’t remember when I added the above. In any case, I do have a working setup.

The WEBHOOK_URL and N8N_HOST is key and should fix it. This is why i think you should definitely give it a kick with: docker compose up -d

Khem

Ran docker-compose up -d and now I have this error. I also did add the fowarding headers
Firefox can’t establish a connection to the server at wss://n8n.aidanwilliams.xyz/rest/push?pushRef=k8bhactwth.

Turns out you’re hitting every issue I faced some time ago. So this is websockets error.

Edit your nginx. (Backup your existing nginx config first. I don’t want these changes to break more things.) Add this ‘map’ outside of the server block and the “proxy_set_header” you see below. This should fix the wss issue. This is related to the “connection lost” message along the top:

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
   # .... other stuff
    location / {
        # ... bunch of stuff
        
        # Dynamic Headers for WebSocket Support
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;

        # Standard Proxy Headers
        proxy_http_version 1.1;
        chunked_transfer_encoding off;

Khem

So At the end it should look like this?

    server_name n8n.aidanwilliams.xyz;
    client_max_body_size 20m;

    location / {
        proxy_pass http://localhost:5678;
        proxy_set_header Connection '';
        proxy_http_version 1.1;
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;
        proxy_set_header Host $host;
        # Dynamic Headers for WebSocket Support
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;

        # Standard Proxy Headers
        proxy_http_version 1.1;
        chunked_transfer_encoding off;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/n8n.aidanwilliams.xyz/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/n8n.aidanwilliams.xyz/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

}
        proxy_http_version 1.1;
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;

        # Forwarding Headers
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;
map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {

server {
    if ($host = n8n.aidanwilliams.xyz) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name n8n.aidanwilliams.xyz;
    return 404; # managed by Certbot


}````

Hi,

Maybe…This is my file as a public gist. You can compare against it. Make sure to restart nginx:

Khem

2 Likes