What external and internal port does n8n listen and how to change it?

Suppose I have a virtual server.
There is no reverse proxy installed (like a Nginx).

I have installed only n8n. SSL Cert hasn’t been installed yet.

  1. What external port does n8n listen?

  2. What internal port does n8n listen? I will require if I will install Nginx

  3. How to change these ports?

  4. Will the change cause the problems in future?

Both port 5678.

You can change it by setting the environment variable N8N_PORT as described here:
https://docs.n8n.io/reference/configuration.html#publish

1 Like

If I enter in browser’s adress bar http://example.com or https://example.com I will see nothing?
Because http prefix says browser to connect to 80 port and https - to 443 port?
Am I right?

Yes, that is right. So you either have to change it to port 80 or 443 and then provide an SSL certificate.

Can n8n work on 80 port without SSL cert? Or it allows only incoming SSL connections?

Port 80 is the port for non-SSL connections. So for that one you would never need a SSL cert. Only if you run on 443 to use https.

n8n will also run totally fine on port 80. You just have to be aware that the connection is not secure and some services will decline to create webhooks to your n8n instance for exactly that reason.

The problem that you are going to run into running n8n on ports 80 or 443 is that only applications with root credentials can use ports below 1024 since these are privileged ports.

While this is easily doable, it does open up a security risk as any n8n workflow is now running as root. If someone were to get access to your n8n admin interface, they can essentially take over your entire server with ease.

Thanks for notice.
Did you check it?
How to check whether n8n’s proceses running with root privilegies or not-root?

If you run the n8n command from the root account or by using the sudo command, you are running with root privileges.