Install n8n on my subdomain server

Hello there great community.

I have this question,

I have a VPS with Centos 7 OS, I am using Nginx. Docker also installed on my server.

My issue, is how i install it ONLY on a subdomain.

I have followed the step accordingly to what explained here https://docs.n8n.io/#/server-setup, but seems i am missing something.

Here is how i did it:

1- i created a subdomain and connect to my vps via cloudflare
2- i created a folder n8n in the root folder.
3 - I created the file docker-compose.yml and put in the n8n folder.
4- i created data.env file -i changed some of the info, like domain and others- and place it in the n8n folder.
5- i opened the n8n folder and run this command:

sudo docker-compose up -d

Here is what i get:

what is the issue i did ?

thanks for the help in advance.

Welcome to the community @Mohdlatif!

The problem seems to be step 4. The file is not called data.env it is just called .env (so it really starts with a dot).

Thanks for the reply Jan.

I changed it and here is what i got

Does that mean, i have to close the port 443 ?

Actually the opposite. It says that port 443 is already in use and because of that it can not be used by docker (traefik, n8n).

Seems port 443 is used by nginx

Is there a way to change n8n port to something else ?

Changing the n8n port is sadly not the problem here. That would be very simple. The problem is that 443 is the default SSL port and you can not use a different one because else no SSL certificate can be created by Lets Encrypt.

OMG, surely there is a solution for it.
What can you recommend me to solve this issue.

There are probably many. Some more complicated than others. So depends on how much experience you have. A simple one would be to also serve your existing website through docker/traefik.

Can you disable SSL on your NGINX service? Or move the NGINX SSL service to 1433? That would then free up the port for n8n.

@ Tephlon Thank you for the reply, i would appreciate if you can guide me on how to move NGINX SSL service to 1433

Give this a quick read:

https://www.tecmint.com/change-nginx-port-in-linux/

It will point you in the right direction.
If you are still having issues, then reach back out to me. Iā€™m more than happy to help out!

1 Like

Thanks a lot @Tephlon!

@Mohdlatif you should however be aware that kind of consequences that will have. If you have the domain example.com and you can currently reach it via https://example.com that will afterwards not be the case anymore. You will then only be able to reach it via https://example.com:1433
So it would be OK if you just use that page by yourself or within a company but for everything else that is probably not what you want to do as it will break the page for all of your users. That is why I serve everything through traefik as it would be one way to keep all pages running through the correct port.

Some excellent points @jan. Each user needs to clearly understand what their needs case is for their particular circumstances. What changing the SSL port may work perfectly fine in some instances, in others, you may be courting with disaster!