Create an SSL Certificate for n8n Server Using Nginx
Requirements
-
A server running Ubuntu (or a similar OS that supports Certbot).
-
Nginx installed.
-
n8n installed and running.
-
A domain name pointed to the server’s IP address.
-
Ports 80 and 443 open.
1. Install Certbot
Certbot is a tool used to generate and renew SSL certificates from Let’s Encrypt.
a. Install Certbot on the host machine
b. Verify installation
The result will display the version, e.g.: certbot 2.x.x.
c. Generate an SSL certificate
-
--standalonetells Certbot to run a temporary web server for domain validation. -
-d yourdomain.comis your domain name.
Certbot will ask you a few questions (such as your email for notifications). Enter the details and wait a few seconds. Once completed, the certificates will be stored in:
Now, copy the certificate files into the ./certs directory:
Restart Nginx:
d. Set up automatic renewal
Certificates need to be renewed before they expire. Steps:
-
Renew the certificate when it has fewer than 30 days left.
-
Copy the new certificate files into the
./certsdirectory. -
Reload Nginx inside Docker to apply the new certificate.
Create a script
Paste the following content (make sure to replace yourdomain.com with your actual domain):
Give execution permissions to the script:
Add the script to a cron job
Edit the cron table:
At the end of the file, add the following line to run the script every day at 2 AM:
e. Test the setup
Check if Certbot renewal works:
If successful, you’ll see a message like “Simulating renewal”.
Test the renewal script:
If no errors appear and Nginx reloads successfully, everything is working fine.




