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
b. Verify installation
The result will show the version, for example: certbot 2.x.x.
c. Generate an SSL certificate
-
--standalonetells Certbot to run a small temporary web server to validate your domain. -
-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 certificate will be stored at:
Copy the files into the ./certs directory:
Restart Nginx:
d. Set up automatic renewal
Steps:
-
Renew the certificate before it expires.
-
Copy the new certificates into the
./certsdirectory. -
Reload Nginx inside Docker to apply the new certificates.
Create a script
Paste the following content (make sure to replace the domain with your actual one):
Make the script executable:
Add the script to cron
Edit cron jobs:
At the end of the file, add the following line to run the script daily at 2 AM:
e. Test the script
Check if renewal works:
If successful, you’ll see a message like “Simulating renewal”.
Run the script manually:
If no errors appear and Nginx reloads successfully, everything is set up correctly.




