On your local machine, open a browser and navigate to http://<public IP> (replace the IP address with the one you copied earlier). You should see the default Nginx landing page "Welcome to NGINX! (...)"
Test the webserver
Lastly, enable UFW:
Now allow both Nginx Full and OpenSSH to be accessed from the internet:
We are now ready to configure UFW. First make sure it knows about all your applications by running the below command. It should return Nginx Full and OpenSSH among the available applications.
At this stage, reboot your instance to make sure all previous changes have taken effect.
In this example setup, we will be using UFW to configure iptables. Oracle's Ubuntu image does, however, come with iptables-persistent which would need to be removed. To do so, simply run:
Setting up Firewall (UFW)
You can learn more about the configuration files in PM2 on the official PM2 documentation.
Now, to start n8n, execute the command:
SMTP Setup to Invite Users
Open the generated file, and replace the existing code with the below code snippet:
Execute the command pm2 init simple to generate a simple configuration file.
Configure environment variables via a config file.
Restart the n8n service
Install the latest version of n8n
Stop the n8n service
To update n8n, follow these three steps:
PM2 will now automatically restart at boot.
The above command asks you to run another command. Copy and paste the suggested command. The comment would look like this:
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.
First, start and enable Nginx by executing the following commands:
Configure NGINX 2nd way (on official n8n-pm2 blog)
You should see an output ending with nginx: configuration file /etc/nginx/nginx.conf test is successful. We can now proceed with reload NGINX to apply the newly added configuration:
Now link the file we have just created to the sites-enabled folder and afterwards test your configuration to make sure everything is understood by NGINX:
Exit the editor by pressing Ctrl+X and then confirm with Y when asked whether you want to save the changes made.
Now insert a copy of the below example configuration and replace
The last step is making your n8n instance available to the outside world. To do so, we create what NGINX calls a server block (a configuration block that defines how a server responds to requests):
Configure NGINX 1st way
Make sure NGINX is running:
The below command should return Active: active (running) among other information.
The last piece to install is NGINX. This will be our reverse proxy accepting requests from the internet and forwarding them to n8n. It can easily be extended in case you want to run additional applications on the same instance.