i am little bit confused here , so i did the following things , please tell me is this the right thing i did or anything else please suggest me
You learned how to set up n8n via PM2 and access the n8n workflow designer via the IP address. In this section, you will learn how to configure Nginx and an SSL certificate to point n8n to your domain.
Keep in mind that this setup is not officially supported by n8n and we recommend the server setup page. If you don’t set up the domain and SSL, most trigger nodes won’t work.
First, start and enable Nginx by executing the following commands:
sudo systemctl start nginx
sudo systemctl enable nginx
Next, create a configuration file by executing the command sudo vi /etc/nginx/conf.d/n8n.conf
. Add the following configuration and save the file.
server {
server_name subdomain.example.com;
location / {
proxy_pass http://localhost:5678;
proxy_http_version 1.1;
proxy_set_header Connection '';
proxy_set_header Host $host;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
}
Configure the A record in the DNS management section for your domain.
Before restarting the Nginx, you need to add the SSL certificate. This will allow you to access n8n via HTTPS and make secure calls to webhooks.
Execute the following commands to install the required packages:
sudo apt install software-properties-common
sudo apt update
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python3-certbot-nginx
Once installed, generate the SSL certificate using the command:
sudo certbot --nginx -d subdomain.example.com
Finally, update your ecosystem.config.js file with the following configurations:
module.exports = {
apps : [{
name : "n8n",
env: {
N8N_BASIC_AUTH_ACTIVE:true,
N8N_BASIC_AUTH_USER:"USERNAME",
N8N_BASIC_AUTH_PASSWORD:"PASSWORD",
N8N_PROTOCOL: "https",
WEBHOOK_TUNNEL_URL: "https://subdomain.example.com/",
N8N_HOST: "subdomain.example.com"
}
}]
}
Now restart Nginx and PM2 using the command sudo systemctl restart nginx and pm2 restart ecosystem.config.js, respectively.
Navigate to your domain, and you will now be able to access n8n.
Note that the SSL certificate will expire after a certain period of time. You need to periodically run the following command to renew the certificate. Refer to the Certbot documentation to learn to setup automated renewal.
sudo certbot renew
is this i supposed to do ???