URL Change LocalHost to Servername

Hello Everybody, this are my first steps in n8n: My Server is Ubuntu an i install N8N with NGINIX with Cert everything, Website is available on my FQDN. So My Problem; when is invite Pepole the link shows http://localhost:5678. I want to change this to FQDN: For exsample: Https://my machine.my domian.de.. I don´t find this setting where is the path on my Machine what includes the Variabel. I dont have docker. For your support thanks a lot. 

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
2 Likes

Hi @rudolph
n8n doesn’t automatically know it’s sitting behind an nginx proxy, so it defaults to localhost.

you just need to pass the WEBHOOK_URL environment variable when n8n starts. that forces all the invite links and webhook endpoints to use your actual https address.

since you aren’t using docker, exactly where you put this depends on how you keep n8n running in the background.

if you set it up as a systemd service (which is pretty standard for ubuntu), just edit your service file. usually it’s at /etc/systemd/system/n8n.service. just add this line under the [Service] section: Environment="WEBHOOK_URL=https://your-machine.your-domain.de"

then run sudo systemctl daemon-reload and restart n8n.

if you’re using pm2 or a .env file in the n8n root directory instead, just drop WEBHOOK_URL=https://your-machine.your-domain.de in there.

Hi @rudolph Welcome to the community!
As you have mentioned you are using ubuntu , and your problem is that your instance is not showing the URL, first make sure your instance is available at that URL before sharing that to someone, second for doing that in linux i mean ubuntu you need to export the env variable , basically just have to type a command:

export WEBHOOK_URL=<yourDomain>

And that is it, what i recommend is that after running this command start n8n after this command in the same shell and it would work as your n8n instance would start at the same domain as you have given there.

Hi first thank you for your answer. i don´t find this file so i create it.
i make some changes and reload the deamon.

But it is not working. It shows again localhost.

What lines must be in this file?

@rudolph
that export command from the other user is great for a quick test. but it dies the second you close your ssh terminal. you definitely want it running permanently.

since you already created that systemd file, let’s just fix it.
open your /etc/systemd/system/n8n.service file and make sure it looks exactly like this:

[Unit]
Description=n8n

[Service]
Type=simple
Environment="WEBHOOK_URL=https://your-machine.your-domain.de"
ExecStart=n8n start
Restart=always

[Install]
WantedBy=multi-user.target

after you save those changes, run
sudo systemctl daemon-reload and then sudo systemctl restart n8n.

Many many thanks. I will test it and let you know.

Hello, so this works thanks a lot, but after reboot, i must restart this deamon manually. Is there a way to automate this? Sorry i am new in Linux

1 Like

@rudolph run this single command:

sudo systemctl enable n8n

that creates a shortcut so ubuntu starts it up the second the server powers on. you won’t have to touch it again.

2 Likes

Im so happy about this Website. Many thanks all Now it works.

1 Like

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