Skip to content

One-command script to self-host n8n.io on a secure, production-ready AWS EC2 Ubuntu instance using Docker, Docker Compose, and Caddy with automatic HTTPS. πŸ”§ Ideal for developers, indie makers, and SaaS builders.

License

Notifications You must be signed in to change notification settings

pixxmohq/n8n-selfhost-aws-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ n8n Self-Hosting Script (AWS EC2 + Docker + Caddy + HTTPS)

Easily self-host n8n β€” the powerful workflow automation tool β€” on an AWS EC2 Ubuntu instance using Docker, Docker Compose, and Caddy for HTTPS.


βš™οΈ Features

  • βœ… One-command install script
  • βœ… Docker + Docker Compose-based deployment
  • βœ… Secure HTTPS via Caddy and Let's Encrypt
  • βœ… Automatic reverse proxy setup
  • βœ… Works with subdomains like n8n.yourdomain.com
  • βœ… Lightweight & production-ready

πŸ“¦ Setup Instructions

⚠️ Important DNS Step

Before running the script, make sure your subdomain (e.g. n8n.yourdomain.com) is correctly pointed to your EC2's public IP:

  1. Go to your domain registrar's DNS settings
  2. Add an A record:
    • Host: n8n
    • Points to: your EC2 public IP
    • TTL: Auto or 600

Wait a few minutes for propagation, then proceed below.

1. πŸ” Clone the repo

git clone https://github.com/<your-username>/n8n-selfhost-aws-setup.git
cd n8n-selfhost-aws-setup

2. βš™οΈ Configure the script

Edit the top variables in setup-n8n.sh:

DOMAIN="n8n.yourdomain.com"
USERNAME="admin"
PASSWORD="strongpassword"
TIMEZONE="Asia/Kolkata"

3. βœ… Run the setup script

chmod +x setup-n8n.sh
./setup-n8n.sh

Once complete, visit:

https://n8n.yourdomain.com

πŸ“ Prerequisites

  • An AWS EC2 Ubuntu instance (20.04 or 22.04 recommended)
  • A subdomain (e.g. n8n.pixxmo.com) pointed via A record to your EC2 IP
  • Domain should allow HTTPS provisioning via Let's Encrypt

πŸ” Security Tips

  • Set a strong username and password
  • Never expose port 5678 directly β€” use reverse proxy only
  • Use a firewall to block all unused ports (e.g., only allow 22, 80, 443)
  • Optional: use PostgreSQL for persistence (instead of default SQLite)

πŸ“‚ Project Structure

.
β”œβ”€β”€ setup-n8n.sh       # Main installation script
└── README.md          # This file
└── LICENSE            # MIT License

🧠 About

This script is maintained by Pixxmo to help developers and indie founders launch their own workflow automation on their infrastructure.

Follow along as I build automation tools and SaaS products at Pixxmo.


πŸ“„ License

MIT License β€” free for personal or commercial use.

About

One-command script to self-host n8n.io on a secure, production-ready AWS EC2 Ubuntu instance using Docker, Docker Compose, and Caddy with automatic HTTPS. πŸ”§ Ideal for developers, indie makers, and SaaS builders.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages