Self hosted N8N using NPM replace DNS

Hi all, I have 2 self-hosted N8N, one is using NPM to install, and one is docker-compose.

For my docker-compose N8N was able to change the access URL to my own DNS(, which only needed to configure the .env file and docker-compose.yml.

But for the NPM N8N I was not able to do it by replacing the localhost:5678 to my own DNS (, what should I configure if my N8N is installed using NPM?

I do research online way which is to install the ngnix and create a .conf file, also change the content inside .n8n/config, but it also does not work.

Appreciate for those who did it before please discuss below, Thanks

Hey @hhlau,

It is the same way really, If you want to configure n8n to use a different domain you just need to set the WEBHOOK_URL environment option which can be done before starting n8n. How you route the traffic to that domain though depends on what you have to use, you could use an nginx reverse proxy or just use Caddy.

If it was me though I would swap out the npm based install for a Docker one as that our recommended solution and you won’t need to know as much about setting environment variables on your OS of choice.

1 Like

yaa… Because in NPM N8N, I’m not so sure where to set the environment variable etc… but in docker-compose only have 2 files that need to be configured…

In future will consider switch to docker after completing the backup…

Hey @hhlau,

For npm n8n it is the same really it is still environment options but they are set on the machine running n8n rather than in a container so you could do something like…

n8n start

or what I do when testing locally is…

export N8N_CONFIG_FILES=~/.n8n-config/config.json
n8n start

Then in my ~/.n8n-config directory (which can be named anything) I have a bunch of different config files so I can swap databases or other options without having to mess around too much.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.