Host n8n in a server where apache is also running

Hello, I want to install n8n in a server that is also running a LAMP stack.

I tried to follow the instructions here but I get (quite understandably) the following error

ERROR: for n8n_traefik_1 Cannot start service traefik: driver failed programming external connectivity on endpoint n8n_traefik_1 (55f4c1c51c8d2e1ea8186e82c36e7fc86210db397b35e9f9ab11e8ae92c22d1b): Error starting userland proxy: listen tcp bind: address already in use

That’s expected since httpd is running on port 443. So I opened the 2020 port in my firewall and tried to change the port to run n8n on docker-compose.yml. Changed 443 to 2020 in the whole document.

However if I go to my browser and try to go to or or even myserverip:2020 it still doesn’t work.

And now I’m not sure if I set up the docker-compose.yml correctly or how to set the .env file (starting from the sample version available in the instructions) to allow for a URL-with-a-port type of configuration (or if there is a way that I missed to make apache and n8n work together)

Thanks in advance

Welcome to the community @nguy!

Another port than 443 will sadly not work. The reason is that it is the default SSH port and Lets Encrypt will not accept any other one:

So the only way to make it work is to get a different server or to convert your existing application to docker and serve it then also via traefik.

At least if you want to use the docker-compose setup with Lets Encrypt. You could obviously anytime run n8n differently like simply npm install it or start only the n8n container via HTTP (not recommended and will cause problems with many services) or buy an SSL certificate and then add it directly to n8n like described here: