How to Install n8n on aaPanel: Complete Step-by-Step Guide for VPS


How to Install n8n on cPanel Hosting

Install n8n on aaPanel

Looking to deploy n8n on your VPS with aaPanel? This comprehensive guide walks you through every step of installing and configuring n8n on aaPanel, from initial VPS setup to production deployment with SSL and reverse proxy configuration.

What is aaPanel?

aaPanel is a free, open-source web hosting control panel that makes server management simple and intuitive. It's the international version of BT Panel and offers a modern interface for managing your VPS, similar to cPanel but completely free. aaPanel supports NGINX, Apache, MySQL, PHP, and includes features like:

  • One-click installation of web applications and services
  • Built-in PM2 manager for Node.js applications
  • Free SSL certificates via Let's Encrypt
  • Firewall management and security features
  • Database management tools
  • File manager with upload/download capabilities
💡 Why Choose aaPanel for n8n?

aaPanel's built-in PM2 Manager makes it perfect for hosting Node.js applications like n8n. It provides an easy-to-use interface for managing Node.js processes, automatic restarts, and log management - all essential features for running n8n smoothly.

Requirements

Before you start, ensure you have:

  • VPS or Cloud Server with at least 2GB RAM (Ubuntu 20.04/22.04 or CentOS 7/8 recommended)
  • Root access to your server via SSH
  • Domain name pointed to your server IP (e.g., n8n.yourdomain.com)
  • Basic knowledge of Linux command line
  • SSH client (PuTTY for Windows, Terminal for Mac/Linux)

Step 1: Get VPS Hosting

🚀 Get Started with VPS Hosting

To run n8n smoothly with aaPanel, you need a reliable VPS with at least 2GB RAM. Creators Choice Host offers powerful VPS plans perfect for hosting n8n and other production applications.

Get VPS Hosting Now →

Here's how to get started with VPS hosting:

  1. Visit Creators Choice Host VPS Hosting
  2. Choose a VPS plan - Minimum 2GB RAM recommended for n8n
  3. Select your operating system - Ubuntu 22.04 LTS recommended
  4. Choose billing cycle and add to cart
  5. Complete checkout and payment
  6. Check your email for VPS credentials (IP address, root password)
  7. Point your domain to the VPS IP address via DNS A record
💡 VPS Requirements for n8n

Minimum: 2GB RAM, 1 CPU core, 20GB SSD
Recommended: 4GB RAM, 2 CPU cores, 40GB SSD
For heavy workflows: 8GB+ RAM, 4+ CPU cores, 80GB+ SSD

Step 2: Install aaPanel

Connect to your VPS via SSH and install aaPanel:

For Ubuntu/Debian:

wget -O install.sh http://www.aapanel.com/script/install-ubuntu_6.0_en.sh && sudo bash install.sh aapanel

For CentOS:

yum install -y wget && wget -O install.sh http://www.aapanel.com/script/install_6.0_en.sh && bash install.sh aapanel

⚠️ Important: The installation may take 10-30 minutes. At the end, you'll receive the aaPanel URL, username, and password. Save these credentials securely!

After installation completes, you'll see output like:

================================================================== Congratulations! Installed successfully! ================================================================== aaPanel URL: http://your-server-ip:7800/xxxxxxxx Username: xxxxxxxx Password: xxxxxxxx ==================================================================

Step 3: Configure aaPanel

  1. Access aaPanel using the URL provided during installation
  2. Login with the credentials shown
  3. Choose installation environment - Select LNMP (Linux + NGINX + MySQL + PHP)
  4. Wait for installation - This may take 20-40 minutes
  5. Change default password - Go to Panel → Change Password for security
  6. Configure security - Enable SSL for panel access (Panel → Security)

Security Tip: Change the default panel port from 7800 to a random port (e.g., 17283) to enhance security. You can do this in Panel → Security → Panel Port.

Step 4: Install Node.js via PM2 Manager

  1. Go to App Store in aaPanel
  2. Search for "PM2 Manager"
  3. Click Install and wait for completion
  4. After installation, click Settings on PM2 Manager
  5. Install Node.js - Select version 18.x or higher (20.x recommended)
  6. Wait for Node.js installation to complete
  7. Verify installation by running in terminal:
    node --version npm --version

Step 5: Create a Website for n8n

  1. Go to Website in aaPanel sidebar
  2. Click "Add site"
  3. Enter your domain (e.g., n8n.yourdomain.com)
  4. Create database: No (n8n uses SQLite by default)
  5. Create FTP: No
  6. PHP version: Pure static (we don't need PHP)
  7. Click Submit

Step 6: Install SSL Certificate

  1. In Website list, click on your n8n domain
  2. Go to SSL tab
  3. Select "Let's Encrypt"
  4. Enter your email address
  5. Select domain (check both www and non-www if needed)
  6. Click Apply
  7. Wait for SSL installation (usually 1-2 minutes)
  8. Enable "Force HTTPS" option
💡 SSL Certificate Requirements

Make sure your domain DNS is properly configured and pointing to your server IP before requesting an SSL certificate. DNS propagation can take up to 48 hours.

Step 7: Install n8n

Now let's install n8n globally on your server:

  1. Open Terminal in aaPanel (top menu)
  2. Install n8n globally:
    npm install n8n -g
  3. Wait for installation (5-15 minutes depending on server speed)
  4. Verify installation:
    n8n --version

⚠️ Note: If you encounter permission errors, use sudo npm install n8n -g

Step 8: Configure PM2 for n8n

Now we'll set up PM2 to manage n8n as a service:

  1. Go to PM2 Manager in aaPanel
  2. Click "Add Project"
  3. Configure the following:
    • Project Name: n8n
    • Startup File: /usr/local/bin/n8n (or wherever n8n is installed)
    • Run Path: /root/.n8n (or your preferred data directory)
    • Port: 5678
    • Node Version: 20.x
  4. To find n8n path, run in terminal:
    which n8n

Step 9: Set Up Reverse Proxy

Configure NGINX reverse proxy to forward requests from your domain to n8n:

  1. Go to Website in aaPanel
  2. Click on your n8n domain
  3. Go to "Reverse Proxy" tab
  4. Click "Add Reverse Proxy"
  5. Configure as follows:
    • Proxy Name: n8n
    • Target URL: http://127.0.0.1:5678
    • Enable: Send Host, WebSocket, Cache
  6. Click Submit
💡 Why Reverse Proxy?

The reverse proxy allows you to access n8n through your domain with SSL (https://n8n.yourdomain.com) while n8n runs on localhost port 5678. This is essential for security and proper webhook functionality.

Step 10: Configure Environment Variables

Set up important environment variables for n8n:

  1. In PM2 Manager, click on your n8n project
  2. Click "Environment Variables"
  3. Add the following variables:
Variable Name Value Description
N8N_HOST 0.0.0.0 Listen on all interfaces
N8N_PORT 5678 Application port
N8N_PROTOCOL https Force HTTPS protocol
WEBHOOK_URL https://n8n.yourdomain.com Your n8n URL
N8N_EDITOR_BASE_URL https://n8n.yourdomain.com Base URL for editor
GENERIC_TIMEZONE Asia/Kolkata Your timezone
N8N_ENCRYPTION_KEY [generate random string] Encryption key for credentials

⚠️ Generate Encryption Key: Run this command to generate a secure encryption key:
openssl rand -base64 32
Save this key securely - you'll need it if you ever migrate your n8n instance.

  1. Click Save
  2. Start the n8n application by clicking the play button in PM2 Manager
  3. Wait 30-60 seconds for n8n to start
  4. Access your n8n instance at: https://n8n.yourdomain.com

Success! If everything is configured correctly, you should see the n8n welcome screen asking you to create an owner account.

Troubleshooting Common Issues

502 Bad Gateway Error

  • Check if n8n is running in PM2 Manager
  • Verify reverse proxy configuration points to 127.0.0.1:5678
  • Check logs in PM2 Manager for error messages
  • Restart n8n application in PM2 Manager

SSL Certificate Issues

  • Verify DNS is pointing to correct IP address
  • Check that port 80 and 443 are open in firewall
  • Wait for DNS propagation (up to 48 hours)
  • Try reissuing the certificate after DNS is confirmed

WebSocket Connection Errors

  • Ensure WebSocket is enabled in reverse proxy settings
  • Check that NGINX configuration includes WebSocket support
  • Verify N8N_PROTOCOL is set to https

n8n Won't Start

  • Check logs in PM2 Manager for error details
  • Verify Node.js version is 18.x or higher
  • Ensure port 5678 is not being used by another service
  • Check file permissions on n8n data directory

Memory Issues

  • Upgrade VPS to at least 2GB RAM
  • Add swap space if running on limited RAM
  • Monitor resource usage in aaPanel dashboard

Maintenance and Updates

Updating n8n

To update n8n to the latest version:

  1. Stop n8n in PM2 Manager
  2. Open Terminal and run:
    npm update n8n -g
  3. Wait for update to complete
  4. Start n8n again in PM2 Manager
  5. Verify version:
    n8n --version

Backup Your n8n Data

Regular backups are essential:

  1. Stop n8n in PM2 Manager
  2. Backup n8n data directory:
    tar -czf n8n-backup-$(date +%Y%m%d).tar.gz /root/.n8n
  3. Download backup via aaPanel File Manager
  4. Store backups in a secure location (cloud storage recommended)
  5. Start n8n again

Security Best Practices

  1. Use strong passwords for n8n owner account
  2. Enable firewall in aaPanel Security settings
  3. Only allow necessary ports (80, 443, SSH port, aaPanel port)
  4. Change default SSH port from 22 to custom port
  5. Set up fail2ban to prevent brute force attacks
  6. Keep n8n updated to latest version
  7. Use SSL/TLS for all connections (already configured)
  8. Regular backups of n8n data
  9. Monitor logs for suspicious activity
  10. Implement rate limiting for webhooks if needed

⚠️ Critical: Never expose your n8n instance without SSL. Always use HTTPS to protect your workflows and credentials.

Performance Optimization

Optimize PM2 Configuration

Configure PM2 for better performance:

  • Set instance count to 1 (n8n doesn't support clustering)
  • Configure auto-restart on crashes
  • Set memory limits appropriate for your VPS
  • Enable log rotation to prevent disk space issues

Database Optimization

For production use, consider PostgreSQL:

  1. Install PostgreSQL from aaPanel App Store
  2. Create database for n8n
  3. Add environment variables:
    DB_TYPE=postgresdb DB_POSTGRESDB_HOST=localhost DB_POSTGRESDB_PORT=5432 DB_POSTGRESDB_DATABASE=n8n DB_POSTGRESDB_USER=n8n_user DB_POSTGRESDB_PASSWORD=your_password
  4. Restart n8n

Execution Data Retention

Configure execution data to save disk space:

EXECUTIONS_DATA_SAVE_ON_ERROR=all EXECUTIONS_DATA_SAVE_ON_SUCCESS=none EXECUTIONS_DATA_PRUNE=true EXECUTIONS_DATA_MAX_AGE=168

This keeps error executions for 7 days and doesn't save successful executions.

Conclusion

You've successfully installed n8n on aaPanel! With proper configuration, SSL, and reverse proxy setup, your n8n instance is now ready for production use. aaPanel's intuitive interface makes managing n8n simple, while PM2 ensures your workflows run reliably 24/7.

Remember to keep your system updated, monitor resource usage, and maintain regular backups. With this setup, you have a powerful automation platform that can handle complex workflows efficiently.

Happy Automating with n8n on aaPanel!