Run n8n on your own server

If you’re looking to self-host your own automation workflows without platform limits or monthly subscriptions, running N8N on your own server is the way to go. In this guide, we’ll walk you through how to install n8n on a Linux server using  Bitnami, complete with **Apache, SSL, PM2, and environment setup.

Step-by-Step Installation

1. Install Node.js (if not already installed)

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash 
sudo apt-get install -y nodejs

Check versions:
node -v
npm -v

2. Install n8n & PM2 globally

sudo npm install -g n8n
sudo npm install -g pm2

3. Configure Apache Reverse Proxy & SSL

Edit the Bitnami Apache config:

sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf

Inside `<VirtualHost *:443>`, add:
apache
ProxyPreserveHost On
ProxyRequests Off
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:5678/$1 [P,L]
ProxyPass / http://127.0.0.1:5678/
ProxyPassReverse / http://127.0.0.1:5678/

Include SSL certificate paths:
apache
SSLCertificateFile “/opt/bitnami/apache2/conf/your-domain.crt”
SSLCertificateKeyFile “/opt/bitnami/apache2/conf/your-domain.key”

Restart Apache:
sudo /opt/bitnami/ctlscript.sh restart apache

4. Set Up Environment Variables

Create the `.env` file:
nano ~/.n8n/.env

5. Start n8n Using PM2

pm2 start &quot;bash -c ‘source ~/.n8n/.env && n8n start’&quot; –name n8n
pm2 save
pm2 startup

6. Enable Auto-Start on Boot

Create the startup script:
nano ~/n8n-start.sh

Make it executable:
chmod +x ~/n8n-start.sh

Restart with PM2:
pm2 delete n8n
pm2 start ~/n8n-start.sh –name n8n
pm2 save 

Troubleshooting

-WebSocket errors? Check Apache’s proxy websocket config.
-SSL issues? Ensure `Listen 443` is enabled in Apache.
-Index page showing? Comment out default Directory blocks.

Final Checklist

– Domain → server IP ✅
– SSL configured ✅
– Apache proxy & WebSockets ✅
– PM2 running n8n ✅
– Auto-start setup ✅

Created with Kuvira Cybernetics – where AI, automation, and creative tech merge.*

🔗 Read full guide: https://drive.google.com/file/d/13a3WXHSUDJ6HvC2Q126Vsal3Lt1ra38O/view?usp=sharing

 

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *