Automation with n8n

Quick notes for setting up an n8n instance on a live server.

server {  
 listen                443 ssl;  
 listen                [::]:443 ssl;  
  
 server_name n8n.fractal-farming.com;  
  
 location / {  
   proxy_pass http://localhost:5678;  
   proxy_set_header Connection '';  
   proxy_http_version 1.1;  
   chunked_transfer_encoding off;  
   proxy_buffering off;  
   proxy_cache off;  
 }  
}

Cloudflare takes care of SSL in my case.

Add the following to your .profile:

# n8n  
export N8N_BASIC_AUTH_ACTIVE=true  
export N8N_BASIC_AUTH_USER=n8n  
export N8N_BASIC_AUTH_PASSWORD='YOUR_PASSWORD'  
  
export N8N_HOST="n8n.fractal-farming.com"  
export VUE_APP_URL_BASE_API="https://n8n.fractal-farming.com/"  
export WEBHOOK_TUNNEL_URL="https://n8n.fractal-farming.com/"

(don't forget to source ~/.profile)

This will route all HTTP requests and webhooks to the correct URL and secure the front-end with a password.