installing n8n in a plesk subscription

How to Run n8n in Plesk as a Node.js Application

If you’re running a Debian server with Plesk and want to set up n8n workflow automation within a specific Plesk subscription, you’ve come to the right place. This guide will walk you through running n8n as a native Node.js application in Plesk, giving you isolated instances per subscription.

Why Run n8n in Plesk?

Running n8n as a Plesk Node.js application offers several advantages:

  • Isolation per subscription – Each client or domain gets its own n8n instance
  • Easy management – Start, stop, and monitor from Plesk’s interface
  • Integrated SSL – Use Plesk’s built-in Let’s Encrypt integration
  • User-level separation – Data and processes are isolated to subscription users

Prerequisites

Before we begin, ensure you have:

  • A Debian server running Plesk
  • Root or admin access to Plesk
  • A domain or subdomain where you want to run n8n
  • Node.js support installed in Plesk

Step 1: Enable Node.js in Plesk

First, verify that Node.js support is available in your Plesk installation:

  1. Navigate to Tools & Settings > Updates > Add/Remove Components
  2. Ensure Node.js support is checked and installed
  3. Alternatively, install via command line:
plesk installer add --components nodejs

Step 2: Set Up Your Domain or Subscription

  1. Go to the domain or subscription where you want to run n8n
  2. Look for Node.js in the left sidebar or under “Hosting & DNS”
  3. If you don’t see it, Node.js may need to be enabled for that subscription

Step 3: Create the Node.js Application

In the Node.js section of your subscription:

  1. Click “Enable Node.js” or “Add Application”
  2. Configure the following settings:
  • Application mode: Production
  • Node.js version: Select 18.x or newer (20.x recommended)
  • Document root: /n8n (or your preferred directory name)
  • Application URL: Your domain (e.g., https://n8n.yourdomain.com)
  • Application startup file: We’ll set this up next

Don’t worry if you can’t complete this step yet – we need to create the files first.

Step 4: Install n8n in Your Subscription

SSH into your server and switch to your subscription’s system user. The username is typically based on your domain name or FTP user.

# Switch to the subscription user
su - your_subscription_user

# Navigate to the document root
cd ~/httpdocs

Now create the n8n directory and install n8n:

# Create directory for n8n
mkdir n8n
cd n8n

# Initialize npm and install n8n
npm init -y
npm install n8n

This will take a few minutes as npm downloads and installs all dependencies.

Step 5: Create the Startup File

We need to create a custom startup script that will launch n8n with the correct configuration:

nano app.js

Add the following code:

const { spawn } = require('child_process');

const n8n = spawn('node_modules/.bin/n8n', ['start'], {
  env: {
    ...process.env,
    N8N_PORT: process.env.PORT || 5678,
    N8N_HOST: '0.0.0.0',
    N8N_PROTOCOL: 'https',
    WEBHOOK_URL: `https://${process.env.DOMAIN || 'yourdomain.com'}/`,
    N8N_BASIC_AUTH_ACTIVE: 'true',
    N8N_BASIC_AUTH_USER: process.env.N8N_USER || 'admin',
    N8N_BASIC_AUTH_PASSWORD: process.env.N8N_PASSWORD || 'changeme'
  }
});

n8n.stdout.on('data', (data) => console.log(data.toString()));
n8n.stderr.on('data', (data) => console.error(data.toString()));

n8n.on('close', (code) => {
  console.log(`n8n process exited with code ${code}`);
});

Save and exit (Ctrl+X, then Y, then Enter).

Step 6: Configure the Node.js Application in Plesk

Return to Plesk’s Node.js interface for your subscription:

  1. Application startup file: Enter n8n/app.js
  2. Add custom environment variables by clicking “Add variable”:
  • Variable: N8N_USER | Value: your_username
  • Variable: N8N_PASSWORD | Value: your_secure_password
  • Variable: DOMAIN | Value: yourdomain.com
  • Variable: N8N_USER_FOLDER | Value: /var/www/vhosts/yourdomain.com/n8n_data
  1. Click “NPM install” to ensure all dependencies are properly installed
  2. Click “Enable Node.js” or “Restart App”

Step 7: Enable SSL

For secure access to n8n:

  1. Navigate to SSL/TLS Certificates in your Plesk subscription
  2. Install a free Let’s Encrypt certificate
  3. Ensure HTTPS is enabled and HTTP redirects to HTTPS

Step 8: Access Your n8n Instance

Navigate to your domain (e.g., https://n8n.yourdomain.com) and you should see the n8n login screen. Use the credentials you set in the environment variables.

Managing Your n8n Instance

One of the benefits of running n8n through Plesk is the easy management:

  • Start/Stop/Restart: Use the buttons in Plesk’s Node.js interface
  • View Logs: Check the logs directly in Plesk to troubleshoot issues
  • Update n8n: SSH into the subscription, navigate to the n8n directory, and run npm update n8n
  • Monitor Resources: Use Plesk’s statistics to monitor CPU and memory usage

Running Multiple n8n Instances

The beauty of this approach is that each Plesk subscription can have its own n8n instance. Simply repeat the process for each domain or subscription you manage. Each instance will be:

  • Completely isolated from others
  • Running under different system users
  • Using separate storage and configurations
  • Independently manageable from Plesk

Optional: Adding a Database

For production use, you may want to connect n8n to a database (PostgreSQL or MySQL):

  1. Create a database in Plesk’s Databases section
  2. Add these environment variables in your Node.js configuration:
  • DB_TYPE: postgresdb or mysqldb
  • DB_POSTGRESDB_HOST: localhost
  • DB_POSTGRESDB_DATABASE: your_database_name
  • DB_POSTGRESDB_USER: your_db_user
  • DB_POSTGRESDB_PASSWORD: your_db_password
  1. Restart the application

Troubleshooting

Application won’t start?

  • Check the logs in Plesk’s Node.js interface
  • Verify Node.js version is 18.x or newer
  • Ensure all npm packages installed correctly

Can’t access n8n?

  • Verify SSL certificate is properly installed
  • Check that the domain DNS is pointing to your server
  • Ensure the application is running (green status in Plesk)

Port conflicts?

  • Plesk automatically assigns ports, so this shouldn’t be an issue
  • If you’re running multiple instances, each gets its own port automatically

Conclusion

Running n8n as a Node.js application in Plesk gives you the perfect balance of isolation, ease of management, and integration with your existing hosting infrastructure. Whether you’re running n8n for yourself or providing it as a service to clients, this method keeps everything organized within Plesk’s familiar interface.

Have you set up n8n in Plesk? Share your experience in the comments below!


Leave a Reply