Tuesday, May 14, 2024

Cara Install n8n di docker - cyberpanel

 I got it after a few tries, it’s working perfectly!

Actually, N8N in cyberpanel is a bit tricky to make it work.

STEPS:

1 - Create a Website, which will redirect to your n8n container (such as n8n.yourdomain.com 1), do not forget to enable SSL for it.

2 - Create a folder with name “files” on public_html, jikasub domain lokasinya di /home/yourdomain.com/n8n.yourdomain.com/files    , permision buat 777

3 - Pull the n8n image and create the container with name “myn8ndocker”. Some relevant information to add to your env data:

WEBHOOK_URL - YOUR N8N URL // your full n8n url here, to enable webhooks, make sure you add https VUE_APP_URL_BASE_API - YOUR N8N URL // same as above

Do not forget to add a persistent volume, in volumes, add:

/home/node/.n8n - /home/yourdomain.com/n8n.yourdomain.com/files

4 - Get it mind your forward port added and login into your ssh. Edit your /usr/local/lsws/conf/httpd_config.conf file with your favorite editor and add the following code in the end of the file: 

extprocessor myn8ndocker { type proxy address http://127.0.0.1:5678 maxConns 100 pcKeepAliveTimeout 60 initTimeout 60 retryTimeout 0 respBuffer 0 }

Save your file!

5 - Go back to your website created in the first step and edit it’s .htacess, adding the following code: dibuat lewat rewrite rules

RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] REWRITERULE ^(.*)$ http://myn8ndocker/$1 [P]

6 - Restart litespeed service and be happy!


https://community.n8n.io/t/install-n8n-on-docker-in-cyberpanel/14029/2

https://hub.docker.com/r/n8nio/n8n