IntegrationsAdvanced★ 4.9 (34 reviews)

n8n Self-Hosted Automation Setup Guide

Complete guide to setting up n8n, the open-source automation platform, on your own server.

By WorkFreeWork Team•412 downloads•Added 12/20/2024

Overview

Take control of your automation with n8n, a powerful open-source alternative to Zapier and Make.com. This guide walks you through setting up n8n on your own server, creating workflows, and integrating with 300+ apps.

Own your data, avoid subscription fees, and build unlimited workflows with this self-hosted solution.

Get This Resource

View on GitHub →

Tags

#n8n#self-hosted#open-source#automation#docker

Prerequisites

  • VPS or dedicated server (2GB RAM minimum)
  • Domain name with DNS access
  • Basic Linux command line knowledge
  • Docker and Docker Compose installed

Dependencies

docker@^24.0.0
docker-compose@^2.20.0
nginx (for reverse proxy)
certbot (for SSL certificates)

Installation

  1. SSH into your server
  2. Clone the setup repository: git clone https://github.com/workfreework/n8n-setup-scripts
  3. Navigate to directory: cd n8n-setup-scripts
  4. Copy environment file: cp .env.example .env
  5. Edit .env with your domain and credentials
  6. Run setup script: ./setup.sh
  7. Configure DNS A record to point to your server IP
  8. Access n8n at https://your-domain.com
  9. Complete initial setup wizard

Usage Examples

Docker Compose Configuration

yaml
version: '3.8'

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=${N8N_USER}
      - N8N_BASIC_AUTH_PASSWORD=${N8N_PASSWORD}
      - N8N_HOST=${N8N_HOST}
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${N8N_HOST}/
      - GENERIC_TIMEZONE=America/New_York
    volumes:
      - n8n_data:/home/node/.n8n
      - ./workflows:/workflows

volumes:
  n8n_data:

Example Workflow: Email to Slack

json
// This is a simplified representation of an n8n workflow
{
  "nodes": [
    {
      "name": "Email Trigger",
      "type": "n8n-nodes-base.emailReadImap",
      "parameters": {
        "mailbox": "INBOX",
        "options": {
          "filter": {
            "from": "important@example.com"
          }
        }
      }
    },
    {
      "name": "Extract Data",
      "type": "n8n-nodes-base.function",
      "parameters": {
        "functionCode": "return items.map(item => ({
          subject: item.json.subject,
          from: item.json.from,
          body: item.json.textPlain
        }));"
      }
    },
    {
      "name": "Send to Slack",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#alerts",
        "text": "New important email: {{$json.subject}}"
      }
    }
  ]
}

Related Resources

Ready to Automate Everything?

Join our community and get access to premium resources, coaching, and support.

Become a Member