Complete Guide to Hosting n8n on Hostinger VPS: Setup, Configuration, and Best Practices

Affiliate disclosure: this post contains a referral link; we may earn a commission from qualifying purchases.

Direct Answer: How to Host n8n on Hostinger VPS

Hosting n8n on Hostinger VPS involves choosing a suitable VPS plan, securing your server, installing Docker, deploying n8n via Docker, configuring environment variables including your domain and credentials, and setting up HTTPS with a reverse proxy like Nginx. This grants you full control over your automation workflows with improved performance and security.

Prerequisites Before You Begin

  • Hostinger VPS Plan: Select a VPS with at least 2 GB RAM, recommended 4 GB or higher for production workloads running multiple workflows.
  • Domain Name: A registered domain pointed via DNS A record to your VPS public IP address.
  • Basic Linux Command Line Skills: Required to manage VPS via SSH.
  • SSH Access: Know your VPS login credentials and how to access it securely.
  • Docker Installed: n8n runs smoothly inside Docker containers, simplifying deployment and updates.
  • SSL Certificate: Use Let’s Encrypt or other SSL options for HTTPS encryption.

Step-by-Step Instructions for Hosting n8n on Hostinger VPS

  1. Purchase and Prepare Your Hostinger VPS
    • Choose Hostinger VPS plan with 2-8 GB RAM depending on your workflow complexity.
    • Access your VPS via SSH (e.g., ssh root@your_vps_ip).
    • Update your package list: sudo apt update && sudo apt upgrade -y
  2. Install Docker and Docker Compose
    • Install Docker using official convenience script:
      curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
    • Install Docker Compose (ensure to check latest version for commands):
      sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
      sudo chmod +x /usr/local/bin/docker-compose
    • Verify installation: docker --version and docker-compose --version
  3. Create n8n Docker Environment
    • Create a new directory, e.g., mkdir ~/n8n && cd ~/n8n
    • Create a docker-compose.yml file with minimal configuration as below:
    version: '3'
    services:
      n8n:
        image: n8nio/n8n
        restart: always
        ports:
          - '5678:5678'
        environment:
          - N8N_BASIC_AUTH_ACTIVE=true
          - N8N_BASIC_AUTH_USER=yourusername
          - N8N_BASIC_AUTH_PASSWORD=yourpassword
          - N8N_HOST=yourdomain.com
          - N8N_PORT=5678
          - N8N_PROTOCOL=https
          - VUE_APP_URL_BASE_API=https://yourdomain.com/
        volumes:
          - ./n8n:/home/node/.n8n
        
    • Replace yourusername, yourpassword, and yourdomain.com with your own credentials and domain.
  4. Configure HTTPS with Nginx Reverse Proxy
    • Install Nginx: sudo apt install nginx -y
    • Create Nginx site config for your domain with proxy to n8n container at port 5678.
    • Enable Let’s Encrypt SSL Certificate with Certbot:
    • Install Certbot and necessary plugins:
      sudo apt install certbot python3-certbot-nginx -y
    • Run certbot for automated SSL setup:
      sudo certbot --nginx -d yourdomain.com
  5. Start n8n Container
    • Run Docker Compose:
      docker-compose up -d
    • Verify container is running:
      docker ps
  6. Access and Test n8n Installation
    • Go to https://yourdomain.com in a browser.
    • Confirm you are prompted for basic auth and can see the n8n interface.
    • Run test workflows to verify functionality.

Best Practices for Performance and Security

Rack with varoius servers.jpg
Image: Wikimedia Commons · Aaron Hall · CC BY-SA 2.0
  • Use Basic Authentication: Enable the built-in n8n basic auth to protect the editor and workflows.
  • Set Environment Variables Carefully: Configure N8N_HOST, N8N_PROTOCOL, and VUE_APP_URL_BASE_API to reflect your domain and protocol to avoid URL misconfigurations.
  • Enable HTTPS: Always serve n8n over encrypted HTTPS for security and API integrity.
  • Regular Backups: Backup the ~/.n8n directory or mounted volume containing workflows and executions.
  • Resource Monitoring: Watch CPU and memory, scaling VPS resources or splitting workflows if necessary.
  • Keep Software Updated: Periodically update Docker images and VPS packages for security patches.
  • Limit Access: Use firewall rules or VPN to restrict access to your VPS and n8n instance where possible.

Troubleshooting and Alternatives

  • n8n Shows localhost Instead of Domain: Confirm N8N_HOST is set to your public domain, not localhost, in your environment variables.
  • Docker Container Exits Immediately: Logs may indicate permission or missing environment variables. Use docker logs container_id to inspect.
  • Issues Connecting via HTTPS: Check Nginx configuration and make sure the SSL certificates are valid and renewed.
  • Alternative Deployment Methods: You can deploy n8n via Coolify or other PaaS platforms, though managing your own VPS offers more control.

How to Verify Your n8n Instance is Properly Hosted

  • Open https://yourdomain.com in a browser and confirm the editor loads securely.
  • Create a simple workflow (e.g., trigger webhook -> respond with JSON) and execute it.
  • Test n8n API endpoints using authenticated requests if applicable.
  • Check Docker container health and logs.
  • Ensure backups are working by restoring to a test environment periodically.

Common Mistakes to Avoid

  • Not configuring N8N_HOST correctly leads to URL and webhook callback failures.
  • Running n8n without authentication exposes your workflows to unauthorized access.
  • Skipping SSL setup results in insecure HTTP connections.
  • Forgetting to expose container ports properly.
  • Neglecting VPS security updates.

Frequently Asked Questions

Can I host n8n on a low-spec VPS?
Yes, but 2 GB RAM is minimum for light usage. Heavy or multiple workflows may require more resources.
Does Hostinger provide one-click n8n installation?
Hostinger offers lightweight VPS with Docker; n8n needs manual Docker setup or third-party tools like Coolify for easier deployment.
How do I secure access to n8n?
Use built-in basic auth, HTTPS encryption, and consider firewall rules or VPN for further protection.
Can I automate n8n backups on Hostinger VPS?
Yes, use cron jobs to regularly backup the n8n data directory or Docker volumes.

Summary

Servers in a Rack.jpg
Image: Wikimedia Commons · Abigor · CC BY-SA 3.0

Hosting n8n on Hostinger VPS gives you direct control over your automation workflows. With a few prerequisites like a properly sized VPS, a domain, Docker installed, and basic Linux skills, you can deploy n8n securely with a reverse proxy and HTTPS. Following best practices such as securing with basic auth and regular backups will ensure a stable, secure automation environment.

Advanced Configuration Tips for n8n on Hostinger VPS

Once the basic setup is complete, you might want to enhance your n8n installation with additional configurations that improve security, scalability, and maintainability.

Use a Dedicated Database for n8n

By default, n8n uses SQLite for storing data inside the container. For production environments, it is recommended to use a more robust database such as PostgreSQL or MySQL.

  1. Install a PostgreSQL server: You can install PostgreSQL on your VPS or use a managed database service.
    Example to install on VPS:
    sudo apt install postgresql postgresql-contrib
  2. Create a PostgreSQL database and user for n8n:
    sudo -u postgres psql
    Within the psql shell:
    CREATE DATABASE n8n_db;
    CREATE USER n8n_user WITH ENCRYPTED PASSWORD 'yourpassword';
    GRANT ALL PRIVILEGES ON DATABASE n8n_db TO n8n_user;
    \q
  3. Modify your docker-compose.yml to use PostgreSQL:
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=localhost
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=n8n_db
      - DB_POSTGRESDB_USER=n8n_user
      - DB_POSTGRESDB_PASSWORD=yourpassword
    

    Make sure PostgreSQL is accessible inside the Docker network or configure accordingly.

Enable Persistent Data Volumes

To avoid data loss when containers restart or update, map volumes to local directories on your VPS.

  • Map ~/.n8n directory outside the container as shown in the docker-compose.yml example.
  • Regularly back up this directory or database dumps.

Configure Automatic SSL Renewal

Let’s Encrypt certificates expire every 90 days, so set up auto-renewal via cronjob:

sudo crontab -e
# Add this line to renew certificates daily at 2 am and reload nginx if renewed
0 2 * * * /usr/bin/certbot renew --quiet --renew-hook "systemctl reload nginx"

Verifying Server Security and Performance

Check Firewall Rules

Configure your VPS firewall using ufw or iptables to restrict open ports only to those required:

  • Allow SSH (port 22) with limits to prevent brute force attacks.
  • Allow HTTP (80) and HTTPS (443) for web access.
  • Block other unused ports.

Example using ufw:

sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
sudo ufw status

Monitor Resource Usage Regularly

Ensure your VPS is not over-utilized, which could cause workflow delays or failures. Use monitoring tools like htop, docker stats, or install Prometheus/Grafana for advanced metrics.

Troubleshooting Common Issues

n8n Not Accessible via Domain or SSL Errors

  • Verify DNS A record points to the VPS correctly.
  • Ensure Nginx server blocks are configured for your domain and listening on ports 80 and 443.
  • Check the Certbot logs at /var/log/letsencrypt/ for SSL certificate issues.
  • Restart Nginx and Docker containers after any configuration change.

Docker Container Restarts or Crashes

  • Inspect logs with:
    docker logs n8n
  • Check environment variables are correctly set, especially credentials and host details.
  • Inspect volume bindings and permissions to ensure data directories are accessible.

Workflows Not Executing or Timing Out

  • Confirm your workflow triggers are reachable and configured correctly.
  • Increase VPS CPU/memory resources if experiencing performance bottlenecks.
  • Run docker stats to identify any resource issues.

Frequently Asked Questions (Expanded)

Can I run multiple n8n instances on the same VPS?
Yes, by using different ports and directories for each Docker container, but ensure adequate resources. Alternatively, consider container orchestration tools like Docker Swarm or Kubernetes.
How do I update n8n to the latest version?
Pull the latest Docker image with docker-compose pull and restart with docker-compose up -d. Always backup your data before upgrading.
Is it possible to use external storage for n8n workflows?
Yes, you can mount external volumes or use cloud storage solutions, but ensure the storage is mounted correctly inside your container and has proper permissions.
How can I schedule workflow executions?
Use n8n’s built-in cron node or webhook triggers. Scheduling does not depend on the VPS but on your workflows’ design.
How do I secure n8n beyond basic authentication?
Consider implementing IP whitelisting, VPN access, or integrating OAuth for user management. Also, keep your VPS firewall rules strict.

Related service

If you are considering VPS, self-hosting, n8n infrastructure and deployment articles, you can review Hostinger KVM 2 VPS (24-month cart). Compare features, pricing and suitability before deciding.

Leave a Comment

Scroll to Top