I keep getting either a "Bad Gateway" or a 404 error when trying to access my n8n app instance from my browser

I cannot seem to access the n8n UI/instance from my browser. My A record has been configured to map my subdomain to the server’s IP address but anytime I try to access it I get a “Bad Gateway” error. Earlier on, when I ran the “docker ps” command, I did not get any port information in the n8nio row, just like the traefik row.

I modified my “ports” data under the n8n section in my yaml file to say “server’s IP:5678:5678” because initially it was set to “”

Could someone please help? Thank you.

Information on your n8n setup

  • n8n version: 3.7
  • Database (default: SQLite): Postgres
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu

Hey @paulugwuanyi,

Welcome to the community :tada:

It looks like Traefik might not be running so I would maybe start there, It would be worth making sure you don’t have any other web servers running locally like Apache2 or Nginx as that would result in a port conflict and stop it from loading.

You could also try to connect using the IP of the server and the port for n8n to see that lets you in. Normally though you can leave the port to as you wouldn’t need to do the above and access it by the IP and the reverse proxy will take care of the routing for you.

Hi Jon, thanks a lot for the warm welcome. I sincerely appreciate it.

Since my message from yesterday, I have not reconfigured my yaml file and these are currently the states of the ports on the server in addition to the current docker processes :

As you can see, at the top are my traefik’s configured ports and below are my n8n’s ports:

It doesn’t seem there are any other services causing a port conflict. Would you recommend putting my loopback address and port as the traefik’s port configuration?

Hey @paulugwuanyi,

I would start by checking the log for Traefik to see why it has no uptime and also double check the log for n8n to make sure it is starting ok as up for 9 seconds is odd and it could be in an error loop.

Sorry, but how do I do that?

Hey @paulugwuanyi,

It should be in the output of the docker log command for the container, You can find the docker commands for finding the logs here: docker container logs | Docker Docs

I would be tempted to start your install again just to make sure nothing was missed from any guide you may be following.

While we would love to help everyone get set up self hosting n8n is considered an advanced feature and one of the requirements is being able to manage containers this typically helps save time and it is important to know how to secure your environment.

I was able to take a look at the logs. Thanks for the resource. I’ll admit, I’m not too conversant with working in/with containers. But I’m willing to take this opportunity learn as I go along.

This is the output from my n8n’s log file:

…my postgres’ log:

And my traefik’s log, clearly empty:

Should I send over my .env and .yml files?

Hey @paulugwuanyi,

So looking at those there is a problem with the database username / password and the user may not have been created. Have you tried manually connecting to the database with the credentials you are using to see if they connect?

No I haven’t.