Nginx configuration

Hi :wave:
I tried to install n8n on my server. I use nginx to make the bridge between n8n.mydomain and localhost:5678.
It works, I can access to the interface. The problem is that I have the message “Server connection could not be established. The server is down or there is a connection problem. It will reconnect automatically as soon as the backend can be reached.”
Is there a port to configure in addition to 5678?


hope that helps:

# How n8n should be made available. Gets by default also used to create the base of the webhook URL.

# If the Webhook URL is different because for example there is a reverse proxy in front of it and n8n does
# use port 4000 but is reachable from the outside via 443 it can be overwritten with:

# This URL gets used in the Frontend to tell it where the backend can be found

So the error you describe sounds to me like that either the environment variable VUE_APP_URL_BASE_API is not set correctly or n8n is not reachable.

Can you tell me what happens when you click on the “+” on the right side to create a node. Does the list contain any nodes?

1 Like

I use the npm package.
I configure my file .profile like this :

export N8N_HOST="localhost"
export N8N_PORT=5000
export N8N_PROTOCOL="http"
export WEBHOOK_TUNNEL_URL="http://n8n.mydomain/" 
export VUE_APP_URL_BASE_API="http://n8n.mydomain/" 

n8n use well my .profile. I check it by changing port.

When I click on “+”, I can select and configure nodes. But when I try to execute, I get this message :
" Problem running workflow
There was a problem running the workflow:
No active connection to server. It is maybe down."

You could just try to access n8n locally. So set:

export VUE_APP_URL_BASE_API=“http://localhost:5000/”

And then open it also via that URL.

Btw. if you need the UI to be web-accessible you can have a look at this:

That should solve your problem. Because if you can see the nodes it means that the UI can reach the API. So everything is configured correctly in that regard. So then it is probably a problem with EventSource and how it does not work correctly. with your Nginx setup.

I will try to add proper documentation about that soon.

I’ didn’t see there was the same issue on github.
Thank’s for your help ! :pray:

To summarize a config that works on nginx for those who need while waiting for the doc :wink:

nano /etc/nginx/sites-available/

server {
   listen 443 ssl;
   listen [::]:443 ssl;
location / {
   proxy_pass http://localhost:5678;
   proxy_set_header Connection '';
   proxy_http_version 1.1;
   chunked_transfer_encoding off;
   proxy_buffering off;
   proxy_cache off;

If not done before:

ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

nano .bashrc

# n8n
source ~/.profile
systemctl restart nginx.service

Then just run n8n and you can access it from


Thanks a lot @Arnaud!

Will make it later much easier for me to add it to the documentation if you already did the most of the work :wink:

1 Like

I also put that here. It’s probably not the best way to launch n8n but it can help.

How to start automatically n8n with systemd:
nano /etc/systemd/system/n8n.service (the location depends on your os)

Description=n8n service

ExecStart=/usr/bin/node /usr/lib/node_modules/n8n/bin/n8n

systemctl daemon-reload
systemctl enable n8n
systemctl start n8n
systemctl status n8n

(if it’s not working see the logs with journalctl -u n8n.service -e)

1 Like

@Arnaud Great, thanks! Yes, I think “not the best” is always better for people than not having any way at all :wink:

Have personally not the slightest idea about “systemd” or anything related. I am sure this solution is good enough for now and if something can get improved I hope at some point somebody will point it out.

1 Like

Thanks for the proxy_pass configuration, that was helpful :slight_smile:


Why not use pm2 for serving?

Hey @moazzam! Welcome to the community!

PM2 is something that is starting to be used with n8n. In fact, it is one of the core services in the n8n-pi. I have written an article about using PM2 and n8n which may be helpful for those working with this setup:

1 Like

Is there a reason to not use systemd? You said it’s “probably not the best way”, but these days it’s probably the most standard way to handle services.

This is what worked for me. Also do not forget to open port 5678 when using AWS EC2 or lightsail

1 Like