N8n along with other virtual host applications

I followed the server setup documentation here and installed n8n on a subdomain say flow.example.org. We’re already running 2 other virtual hosts troy.example.com and janice.example.com in the same server.

When I try to visit flow.example.org I see troy.example.com.

I have never used docker, but I have double-checked the docker-compose file and .env file, the URLs are configured correctly. Can you please explain what went wrong?

Welcome to the community @claudiamaximus!

Honestly no. Is sadly impossible to answer. There is simply way to much unknown here. Like how is “troy” or “janice” set up? Via the same docker-compose setup via traefik or totally differently? If it is separate do they all use the same port (like 443?) because that will cause problems as two different applications try to access the same port. So assume only one starts properly and the other one fails.
If it is all via docker and traefik then I guess something is wrong in the setup.

Sorry, my bad. Troy and Janice are PHP and Python apps. They run without any containerisation. Yes, they all use same ports (80 and 443), configured as two different virtual hosts.

My understanding about docker and this traefik is very basic. I have never used them until today.

Sadly is my traefik knowledge also very basic.

So if the PHP application already uses port 80 and 443 I would expect that it is not possible to start docker compose at all. Does it not display you a lot of error messages if you try to?

Best to see them directly is if you stop the setup again with:

sudo docker-compose stop

and then start the up command with the -d so just:

sudo docker-compose up

It should then directly output everything into the terminal and if there are issues you should see it. You can then stop it again with ctrl+c.

Anyway I guess you would need to free up port 443 no matter what. Here are some similar issues which partly also talk about possible solutions:

The challenge that you are running into is that your VPS is technically running two different web servers; the (I’m assuming) Apache server which is serving up your main sites and the n8n “server” giving out the n8n piece. And, these two servers are unaware of each other.

What you may wish to look into is a proxy/load balance system (e.g. NGINX) that knows about both of the servers and then redirects the requests to the proper site. This would take some work to get running properly but would produce the results you are looking for.

I tried stopping it and starting again, I did not see any errors. Here is the verbose,

Starting claudia_traefik_1 ... done
Starting claudia_n8n_1     ... done
Attaching to claudia_traefik_1, claudia_n8n_1
n8n_1      | ln: /home/node/.n8n: File exists
traefik_1  | time="2020-05-08T17:46:25Z" level=info msg="Configuration loaded from flags."
n8n_1      | n8n ready on port 5678
n8n_1      | Version: 0.66.0
n8n_1      |
n8n_1      | Editor is now accessible via:
n8n_1      | https://flow.example.org:5678/

https://flow.example.org displays troy.example.com. But accessing https://flow.example.org:5678/ results in a network timeout.

@Tephlon yes thanks a lot! That would be a good possible solution but is for sure not easy to do if you to not have the technical knowledge.

Ah yes, n8n uses only “internally” the port 5678, externally (so accessible from the internet) it is 443 which is the the SSH port.

Apart from that does it seem strange. There should be way more output from traefik.

No matter what you should check the topics I did link above.

This makes sense, a bit. Is there a way to make Apache and n8n’s server to know about each other? And by NGINX, you mean placing another web server in between Apache and n8n? If you could tell me the logical part of it, I’ll be able to grasp it and try it.

Is there a way to install n8n without docker and configure SSL and webserver manually?

Yes, you can simply npm install n8n:

Thanks. How do I uninstall the existing docker version? Sorry to keep asking basic questions, I am really new to these new technologies like docker and I am not sure what folders need to be removed and if there is a neat way to do it.

Also, running npm install n8n -g throws these errors. I tried with sudo but still shows permission errors.

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This version of pg-promise is obsolete. You should update to a newer version.
/usr/bin/n8n -> /usr/lib/node_modules/n8n/bin/n8n

> [email protected] install /usr/lib/node_modules/n8n/node_modules/mmmagic
> node-gyp rebuild

gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/home/claudia/.cache/node-gyp/12.16.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/n8n/node_modules/mmmagic/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/n8n/node_modules/mmmagic/.node-gyp'
gyp ERR! System Linux 4.15.0-96-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/n8n/node_modules/mmmagic
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/claudia/.npm/_logs/2020-05-08T19_05_30_392Z-debug.log

The problem that you are running into with the errors has to do with the combination of installing NodeJS globally (often with sudo) and then n8n globally is that the user does not have proper permissions to the global folders. Take a look here:


Following these instructions will hopefully resolve the issues.

1 Like

The new design would look something like this:


That is the nice thing about docker. You do not really have to uninstall anything there. If you however want to save some disk-space you can remove the docker images you do not need anymore.
For n8n and traefik that would be:

docker rmi n8n:latest traefik:latest

@Tephlon Thanks a lot!

1 Like

Hi Jan,

I used a fresh server and got it working. Thanks. I have a small feedback. It would be nice if the installation documentation covers n8n setup on existing servers too. Perhaps someone from the community can help it. Thanks much.

Great to hear that you got it working!

Yes, I agree that such a guide would be great!

The problem is just that just one guide would not cover it, as each existing setup would be different. That would mean that multiple guides have to get created and then still some technical knowledge would be needed as not everything can be anticipated or document for every case. But it would be great if people who added n8n to their existing setup would write a short write-up to build a library like this.

We are also currently working hard on the hosted version of n8n. This will then hopefully reduce the need for the own manual setup for many people.

1 Like

I’m working on a couple of n8n based projects right now and one of the byproducts of these projects is an installation script. It will probably be targeted to a specific environment to begin with but could potentially be generalized to multiple environments.

I’ll make sure to release it to the community once it is ready for public consumption.