In the digital era, workflow automation plays a crucial role in optimizing efficiency and reducing manual tasks. n8n is an open-source automation platform that enables seamless connections between applications, services, and processes without requiring complex programming.
This system is deployed on n8n.datacloud.vn, utilizing Docker to ensure flexibility, scalability, and easy management. With HTTPS integration via Nginx Reverse Proxy, the system provides a secure, stable connection, ready for automation tasks.
This guide will detail the deployment of n8n, HTTPS configuration, and system stability assurance.
mục lục
Recommended Configuration
- CPU: 2-4 vCPU
- RAM: 4-8 GB
- Disk: 20-50 GB SSD
Installing Docker & Docker Compose
Step 1: Install Docker & Docker Compose
sudo apt update && sudo apt install -y docker.io docker-compose
sudo systemctl enable –now docker
Step 2: Check the Docker version
docker –version
docker-compose –version
Step 3: Configure n8n with the domain n8n.datacloud.vn
Recreate Directory and Set Correct Permissions
sudo mkdir -p ~/.n8n sudo
chown -R 1000:1000 ~/.n8n
sudo chmod -R 770 ~/.n8n
docker run -d –name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n –restart always n8nio/n8n
Step 4: Verify if the container is running and check on the website
docker ps
Enable HTTPS or Disable Secure Cookie
For security, Datacloudvn recommends installing SSL
2.Installing SSL
Step 1: Install both Nginx and Certbot
apt install -y nginx certbot python3-certbot-nginx
Step 2: Generate an SSL certificate using DNS TXT record authentication and set up email notifications
sudo certbot -d n8n.datacloud.vn –manual –preferred-challenges dns certonly –email hungnguyentran326@gmail.com
Step 3: After updating DNS records, verify them using dnschecker
Step 4: Once DNS propagation is complete, return to the n8n server and press Enter to continue
3.Configuring Nginx Reverse Proxy
Step 1: Create an Nginx configuration file for n8n
nano /etc/nginx/sites-available/n8n
server {
listen 80;
server_name n8n.datacloud.vn;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name n8n.datacloud.vn;
ssl_certificate /etc/letsencrypt/live/n8n.datacloud.vn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/n8n.datacloud.vn/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
location / {
proxy_pass http://localhost:5678/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Step 2: Save and activate the configuration
ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
nginx -t
systemctl restart nginx
Step 3: Configure n8n to support HTTPS
Stop the current container and change the n8n port (5678) to HTTPS
docker stop n8n && docker rm n8n
docker run -d –name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n -e N8N_PROTOCOL=https -e N8N_HOST=n8n.datacloud.vn -e WEBHOOK_URL=https://n8n.datacloud.vn/ –restart always n8nio/n8n
4.Final Verification on the Website
https://n8n.datacloud.vn/
Conclusion
We have successfully completed the deployment of n8n using Docker, ensuring flexibility, scalability, and easy management. With this setup, we can leverage n8n to automate the connection of applications, services, and workflows in a seamless way without the need for complex programming.