Setting up n8n on your own server can feel confusing at first. Docker, domains, ports, webhooks, and databases introduce several moving parts. Many setup tutorials also assume you already understand basic server administration.
A wrong storage setting can remove data when a container changes. Incorrect webhook settings can prevent services from reaching your workflows. Weak server configuration can also create avoidable security problems.
Learning how to set up self-hosted n8n correctly removes much of that uncertainty. You will configure a server, Docker Compose, persistent storage, HTTPS, webhooks, security, and backups. By the end, you will have a practical foundation for running n8n yourself.
What Does It Mean to Self Host n8n?
Self hosting n8n means running n8n on infrastructure that you control. That infrastructure can be a VPS, cloud server, local computer, or private server. You decide where workflows, credentials, execution records, and configuration data are stored.
n8n is a workflow automation platform that connects applications, APIs, databases, and AI services. A workflow can receive a webhook, process data, call another service, and return a response automatically. Self hosting gives you direct control over the environment where those processes run.
That control also creates additional responsibility. You must manage server security, software updates, backups, storage, and availability yourself. n8n warns that self hosting requires knowledge of servers, containers, security, configuration, and scaling.
Self Hosted n8n vs n8n Cloud
Self hosted n8n gives you infrastructure control, while n8n Cloud handles most hosting responsibilities. Both options provide the n8n workflow editor and integrations. The main differences involve maintenance, control, pricing, and infrastructure management.
n8n Cloud Starter currently costs €20 monthly when billed annually and includes 2,500 workflow executions. Pro starts at €50 monthly when billed annually and includes 10,000 workflow executions. Both are hosted by n8n rather than on your own VPS.
Self hosting can suit developers, agencies, and technical teams that want more infrastructure control. n8n Cloud can suit users who prefer managed hosting and fewer server responsibilities. Your choice should depend on technical skills, maintenance time, workload, and required control.
What You Need Before You Set Up Self Host n8n
You need a server, Docker, storage, network access, and administrator credentials before installing n8n. A domain is also useful when workflows require public webhooks or OAuth callbacks. Preparing these requirements first makes the installation easier to troubleshoot.
n8n recommends Docker for most self hosting needs. Docker creates an isolated environment and simplifies database and environment management. n8n now directs users toward Docker Compose as the recommended installation approach.
Server, CPU, RAM, and Storage Requirements
There is no single server specification that fits every n8n workload. Resource needs depend on workflow complexity, concurrency, file processing, execution history, and AI workloads. A small personal installation needs fewer resources than a busy production system.
A VPS with 2 CPU cores and 2 GB to 4 GB RAM is a practical starting range. Increase resources when workflows process large files or run many executions simultaneously. AI workloads can also require more memory than basic API automation.
Storage requirements grow as execution history and application data increase. Leave space for the operating system, database, backups, Docker images, and execution data. Monitor real resource usage instead of relying permanently on an initial estimate.
Domain, DNS, SSH, Docker, and Docker Compose
A typical public n8n setup uses SSH, Docker, Docker Compose, DNS, and a domain. SSH provides remote server access, while DNS connects your domain with the VPS address. Docker and Compose control how the n8n application runs.
A subdomain such as n8n.example.com gives the installation a stable public address. This address becomes useful for HTTPS, webhooks, browser access, and OAuth callbacks. You can still run n8n locally without purchasing a domain.
Step 1: Choose Where to Host n8n
Choose a VPS for continuous online automation and a local computer for learning or testing. A VPS remains online when your laptop or desktop is turned off. That makes it more suitable for scheduled workflows and incoming webhooks.
Local hosting works well when you are learning n8n or testing new workflows. Docker Desktop is available for Windows, macOS, and Linux. Docker Desktop also includes Docker Engine and Docker Compose.

Public services cannot normally reach a local localhost address directly. You can use tunneling during development when external callbacks are necessary. Production workflows should use stable hosting and a reliable public address.
Local Computer vs VPS
A local computer is simpler for testing, while a VPS is better for continuous availability. Local installations are useful for learning nodes, building workflows, and testing integrations. They also let beginners learn Docker before managing a remote server.
A VPS works independently from your personal device. Workflows such as scheduled reports, lead processing, payment notifications, and support automation can continue running continuously. Your VPS must still remain healthy and connected to the internet.
VPS vs Managed Hosting
A VPS provides greater control, while managed hosting reduces server administration. With a VPS, you usually manage Docker, backups, updates, firewall rules, and HTTPS. Managed hosting moves more of those responsibilities to the provider.
A VPS can suit users comfortable with basic Linux administration. Managed hosting can suit users who mainly want to build workflows. n8n Cloud is another option when you prefer infrastructure managed by n8n.
Step 2: Prepare Your VPS
Prepare your VPS by connecting through SSH and updating the operating system. Ubuntu is a common Linux choice because Docker provides established installation instructions. Use a currently supported server release rather than an outdated image.
Connect using the administrator account supplied by your hosting provider. Replace the example address with your actual VPS IP address. SSH keys provide stronger access control than weak reusable passwords.
ssh root@YOUR_SERVER_IP
Update installed packages after connecting to the server. This applies available security fixes and package updates before you add n8n. Restart the server if an important system update requires a reboot.
sudo apt update
sudo apt upgrade
Configure Basic Firewall Access
Allow only the ports needed for server administration and web traffic. SSH normally uses port 22, HTTP uses port 80, and HTTPS uses port 443. Your exact SSH port can differ when custom server settings are used.
n8n normally listens on port 5678 internally. A production deployment can keep that port away from direct public access. A reverse proxy can accept secure traffic on port 443 and forward it internally.
Do not block SSH before confirming your access rule works. Losing SSH access can require recovery through your hosting provider console. Apply firewall changes carefully when working on a remote server.
Step 3: Install Docker and Docker Compose
Install Docker Engine and Docker Compose before creating your n8n service. Docker runs n8n inside a container rather than installing application dependencies directly on Ubuntu. Docker Compose stores the service configuration in a reusable file.
Use Docker’s current installation method for your Ubuntu release. After installation, verify that both Docker and Compose respond successfully. The commands below should display their installed versions.
docker --version
docker compose version
n8n recommends Docker because it avoids many operating system compatibility problems. Docker also simplifies environment and database management. The current n8n documentation directs users toward Docker Compose for the recommended installation process.
Step 4: Create Your n8n Docker Compose Setup
Create a project directory and define your n8n service with Docker Compose. Keeping related configuration files together makes updates and troubleshooting easier. It also gives you a predictable location for future changes.
Create a directory called n8n inside your home directory. Open that directory before creating the Compose configuration. You can use another location if your server follows a different structure.
mkdir ~/n8n
cd ~/n8n
Create a file named compose.yaml inside this directory. The following basic example creates persistent storage and restarts n8n automatically. Replace UTC with the timezone that matches your workflow requirements.
services:
n8n:
image: n8nio/n8n
restart: unless-stopped
ports:
- "127.0.0.1:5678:5678"
environment:
- GENERIC_TIMEZONE=UTC
- TZ=UTC
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
The local address binding keeps port 5678 from being directly exposed publicly. A host based reverse proxy can later send secure requests to that address. n8n’s documented Docker configuration also persists /home/node/.n8n through a volume.
Step 5: Configure Persistent Storage and Your Database
Persistent storage keeps important n8n information available when containers restart or are replaced. Containers should be treated as replaceable application environments. Important data should exist outside the temporary container layer.
n8n mounts persistent data at /home/node/.n8n in its Docker example. This directory can contain important application information and should survive container restarts. Deleting persistent data without a backup can make recovery difficult.
A Docker volume is not the same as a complete backup. The volume can remain on the same server that experiences hardware failure or accidental deletion. Keep separate backups outside the production VPS.

SQLite vs PostgreSQL for Self Hosted n8n
SQLite is the default self hosted database, while PostgreSQL is available for larger deployments. SQLite stores credentials, past executions, and workflows without requiring another database server. The default database file is ~/.n8n/database.sqlite.
SQLite works well for learning, testing, and straightforward single instance installations. It reduces initial setup because you do not need to configure another database service. Beginners can start there without immediately introducing PostgreSQL.
PostgreSQL becomes more useful when your architecture grows or requires queue mode. n8n currently supports PostgreSQL 17 and 18 as actively maintained versions, plus version 16 for compatibility. n8n recommends using the latest minor release within the selected major version.
Step 6: Configure n8n Environment Variables
Environment variables control settings such as timezones, databases, public addresses, and encryption. They let you configure n8n without modifying application code. Sensitive values must be stored carefully because configuration can contain passwords and keys.
TZ controls the container system timezone. GENERIC_TIMEZONE controls timezone behavior for schedule based functionality. Set both correctly when workflows depend on specific local times.
PostgreSQL deployments require additional environment variables. These include database type, database name, host, port, username, password, and schema. n8n uses DB_TYPE=postgresdb when PostgreSQL is selected.
Protect the n8n Encryption Key
Protect the n8n encryption key because stored credentials depend on encryption. n8n automatically generates an encryption key when the instance first starts. You can also define your own key through configuration.
Keep encryption information with your recovery records but protect it from unauthorized access. Database data alone may not provide a complete recovery path for encrypted credentials. Do not store private keys inside public repositories.
Scaled deployments require consistent encryption configuration across related n8n processes. n8n states that the main instance and workers must share the encryption key. This allows worker processes to access stored credentials correctly.
Step 7: Connect Your Domain and DNS
Connect your domain by pointing a DNS record to the public IP address of your VPS. A subdomain such as n8n.example.com keeps automation separate from your main website. It also creates a stable address for HTTPS and external callbacks.
Create an A record through your DNS provider. Set the hostname to your chosen n8n subdomain and enter your VPS IPv4 address. DNS changes can take time to appear across different resolvers.
Verify the domain before configuring your SSL certificate. Commands such as dig or nslookup can show the IP address returned for your hostname. The returned address should match your VPS.

A stable domain is particularly useful for webhooks and OAuth integrations. External platforms can continue calling the same hostname even if your internal container configuration changes. Avoid changing production domains unnecessarily after integrations are connected.
Step 8: Set Up HTTPS and a Reverse Proxy
Use a reverse proxy and HTTPS to protect traffic between users and your n8n instance. The reverse proxy receives requests on the public domain and forwards them to n8n. This lets n8n stay on its internal port while visitors use standard HTTPS.
n8n recommends using a reverse proxy for TLS instead of configuring certificates directly within n8n. Suitable tools include Nginx, Caddy, Traefik, and compatible load balancers. You only need one reverse proxy for a normal beginner setup.
The proxy receives secure traffic on port 443. It then forwards the request to n8n on port 5678. This creates a clean address such as https://n8n.example.com.

Using Nginx, Caddy, or Traefik
Nginx, Caddy, and Traefik can all provide reverse proxy functionality for n8n. Nginx offers broad documentation and manual configuration options. Caddy can simplify HTTPS management, while Traefik integrates closely with container environments.
Choose one option based on the environment you understand best. Beginners using a standard Ubuntu VPS often encounter Nginx tutorials first. Container focused environments may make Traefik more convenient.
The proxy must forward requests to the address where n8n listens. If the proxy runs directly on the VPS, 127.0.0.1:5678 can work with the earlier Compose example. A proxy inside Docker requires appropriate Docker networking instead.
Enable HTTPS With Let’s Encrypt
Let’s Encrypt can provide a free trusted TLS certificate for your n8n domain. Reverse proxy tools can request and renew these certificates automatically or through supporting utilities. Automatic renewal prevents expired certificates from interrupting secure access.
Do not treat HTTPS as optional for a public production instance. Login sessions, credentials, webhook traffic, and workflow data can cross the connection. Secure transport reduces exposure to network interception.
Step 9: Configure Webhooks and Public URLs
Configure n8n with the public HTTPS address that external services can reach. This is especially important when n8n runs behind a reverse proxy. The internal address and public address are different in that architecture.
n8n normally builds webhook URLs from its protocol, host, and port settings. Behind a reverse proxy, n8n may run internally on port 5678 while users reach port 443. n8n therefore recommends manually defining the public webhook URL.
Current n8n documentation uses N8N_WEBHOOK_URL for this configuration. The older WEBHOOK_URL variable is deprecated from n8n 2.35.0. n8n also recommends N8N_PROXY_HOPS=1 when one proxy sits before the instance.
N8N_WEBHOOK_URL=https://n8n.example.com/
N8N_PROXY_HOPS=1
The last reverse proxy should forward important request headers. These include X-Forwarded-For, X-Forwarded-Host, and X-Forwarded-Proto. n8n uses that information to understand how the original public request arrived.
Why Webhooks Fail on Localhost
Public webhook providers cannot normally reach localhost on your personal computer. Localhost refers to the machine making the request. It does not point to your VPS or another public computer.
Services such as Stripe, GitHub, and Telegram need a publicly reachable callback URL. That URL normally uses your domain and HTTPS for a production deployment. A local tunnel can temporarily help during development.
Webhook problems can also come from inactive workflows or incorrect URL types. n8n uses test and production webhook behavior for different workflow states. Confirm that the production workflow is active before troubleshooting the server.
Step 10: Start, Test, Secure, and Back Up n8n
Start your n8n instance and verify the complete setup before using it for important automation. Run Docker Compose from the project directory. Then check whether the container remains active.
docker compose up -d
docker compose ps
If n8n fails to start, inspect its logs before changing configuration. Logs can reveal database problems, invalid environment settings, filesystem permissions, or port conflicts. Fix the specific error instead of changing several settings simultaneously.
docker compose logs n8n
Open your HTTPS domain after the reverse proxy is working. Create your owner account and confirm the editor loads without browser certificate warnings. Do not connect critical production systems until basic testing succeeds.
Test One Workflow Before Going Live
Create one basic workflow to confirm that n8n can execute successfully. A Manual Trigger followed by an Edit Fields node provides a simple internal test. Run the workflow and confirm that an execution record appears.
Next, test a webhook if your planned automation needs external triggers. Confirm that the webhook displays your public HTTPS hostname. This single test checks DNS, proxy forwarding, HTTPS, and webhook configuration together.
Do not begin with your most important workflow. Start with a controlled test that has no financial or customer impact. Add production integrations after the environment behaves consistently.
Secure SSH, Ports, and Credentials
Restrict server access to the people and services that actually need it. Use SSH keys where practical and keep Ubuntu, Docker, and n8n updated. Limit inbound firewall rules to required traffic.
Protect API keys, database passwords, and encryption information. Avoid storing credentials in public Git repositories or shared documents. Review access whenever administrators or contractors leave a project.
Keep port 5678 private when the reverse proxy provides public HTTPS access. Public users normally need ports 80 and 443 for web traffic. Your firewall design should reflect the actual services running on the VPS.
Back Up Before Production Use
Create a recovery backup before depending on your n8n instance. Include the database, persistent n8n data, Compose configuration, environment settings, and encryption information. PostgreSQL installations also need database level backups.
Store at least one copy somewhere other than the production VPS. A backup on the failed server cannot protect against complete server loss. Encrypted cloud storage or another secured server can provide off server recovery.
Test your recovery process instead of assuming a backup works. Restore into a separate environment when practical and confirm credentials and workflows remain usable. Recovery testing is especially important before major infrastructure changes.
How to Update n8n Without Losing Data
Update n8n only after verifying persistent storage and creating a recent backup. n8n releases new minor versions most weeks. Production users should therefore treat updates as a controlled maintenance task.
Check release information before changing important production installations. Back up the database, encryption information, environment configuration, and persistent data first. Test critical workflows after the upgrade completes.
Docker Compose can pull the selected image and recreate the service. Your persistent volume remains separate from the replaced application container. Run the commands from your n8n project directory.
cd ~/n8n
docker compose pull
docker compose down
docker compose up -d
Check logs and container status after the update. Test workflows involving webhooks, schedules, databases, OAuth, and external APIs. Version pinning can provide more control when automatic adoption of every new release is undesirable.
Common n8n Self Hosting Problems and Fixes
Most n8n self hosting problems involve containers, DNS, proxies, databases, or persistent storage. Troubleshoot the system layer by layer. Start with Docker before investigating external services.
If the container does not start, run docker compose ps and inspect its logs. Look for configuration errors, database failures, port conflicts, or permissions problems. The error message usually gives a better starting point than random configuration changes.
A 502 Bad Gateway error often means the proxy cannot reach n8n. Confirm that n8n is running and that the proxy targets the correct address. Also check whether both services can communicate through the expected network.
Missing workflows can indicate the wrong database or Docker volume is attached. Missing credentials after migration can indicate an encryption configuration problem. Restore the correct persistent data and encryption information from your backup.
Port 5678 Is Not Accessible
Port 5678 does not need direct public access when a reverse proxy handles HTTPS. Users can connect through port 443 while the proxy communicates with n8n internally. This is normal for a production deployment.
If your proxy cannot reach n8n, confirm that n8n is listening on the expected address. Host based proxies and Docker based proxies may require different networking configurations. Match the proxy architecture to your Compose settings.
Do not open every firewall port to fix a connection problem. Determine which component needs access and from where. Then allow only the required traffic.
Webhooks Are Not Working
Check your public webhook URL before changing the workflow itself. N8N_WEBHOOK_URL should match the HTTPS address used by external services. The workflow must also be active when you use its production webhook.
Confirm that your proxy forwards the required headers. Also verify that your SSL certificate is valid and DNS points to the correct VPS. External providers cannot deliver callbacks reliably when any of those layers fail.
Test webhook delivery with a simple workflow before troubleshooting complex logic. A basic webhook response separates server problems from workflow problems. Once delivery works, investigate the remaining workflow nodes.
How Much Does It Cost to Self Host n8n?
Self hosting n8n can avoid a standard Cloud subscription, but infrastructure still has costs. Common expenses include a VPS, domain, backup storage, monitoring, and administrator time. Resource intensive workloads may also require larger servers.
n8n offers a standard Community Edition for self hosting. n8n Cloud Starter currently costs €20 monthly when billed annually with 2,500 executions. Pro starts at €50 monthly when billed annually with 10,000 executions.
Compare total ownership cost rather than only software pricing. A low cost VPS may require more of your time for backups, security, and troubleshooting. Managed hosting can provide better value when administration time is expensive.
Can You Self Host n8n for Free?
You can run n8n Community Edition without paying for a standard n8n Cloud subscription. Running it on hardware you already own can also avoid a separate hosting bill. This makes local learning and testing inexpensive.
A reliable public production environment normally creates some operating cost. Domains, VPS resources, backup storage, and monitoring may require paid services. Free hosting tiers can also impose memory, uptime, or storage limitations.
Free infrastructure should not be chosen only because the monthly price is zero. Consider whether it can receive webhooks continuously and store your data safely. Reliability matters more once workflows support real business processes.
How to Monitor and Maintain Your n8n Server
Monitor CPU, RAM, disk space, logs, and database growth after n8n goes live. Workloads can change as you add workflows and increase execution frequency. A server that performs well today may later reach resource limits.
Docker provides basic resource information through docker stats. Monitoring services can add alerts for downtime, memory pressure, or low disk space. Logs can help identify why workflows become slower or start failing.
Execution history can also increase database size over time. Keep enough records for troubleshooting and any required auditing. Remove unnecessary execution data according to your retention needs.
Backups should remain part of ongoing maintenance. Update them when configuration, credentials, or database contents change. Review restoration procedures after major infrastructure changes.
How to Scale n8n for Larger Workloads
Scale n8n only when one instance can no longer handle your workload reliably. Most beginner installations do not need Redis, multiple workers, or Kubernetes. Monitor real performance before adding architecture.
n8n queue mode uses a main instance, Redis, and worker processes. The main instance receives triggers and webhooks, while Redis queues executions for workers. Adding workers lets n8n distribute workflow execution across more processes.
n8n does not recommend SQLite for queue mode. PostgreSQL is therefore the more appropriate database when moving toward this architecture. All workers must also share the correct encryption key.
Kubernetes can become useful for larger container environments that require orchestration and automated recovery. It adds operational complexity that a single VPS does not need. Docker Compose remains simpler for most beginner and small business deployments.
Is Self Hosting n8n Worth It?
Self hosting n8n can be worthwhile when you need infrastructure control, data control, or flexible server resources. It can suit developers, automation agencies, technical teams, and businesses already comfortable managing Linux servers. You decide where n8n runs and how supporting services are configured.
The tradeoff is operational responsibility. You manage security, backups, upgrades, monitoring, certificates, and server failures. n8n recommends Cloud for users without sufficient server administration experience because mistakes can cause downtime, security problems, or data loss.
Beginners who want to learn self hosting can start with one VPS and Docker Compose. Add PostgreSQL, monitoring, queue mode, and workers only when they solve an actual requirement. Keeping the first deployment simple makes troubleshooting and maintenance easier.
Conclusion
In conclusion, Setting up self-hosted n8n gives you greater control over automation, data, storage, and server configuration. A reliable deployment depends on Docker Compose, persistent storage, correct networking, HTTPS, secure webhooks, and tested backups.
The 10 step process provides a practical foundation without requiring advanced scaling infrastructure. Start with a simple VPS or local environment, then add PostgreSQL or extra resources when workloads grow. Regular updates, monitoring, and backup testing keep the installation usable after the initial setup.
Your next step is to launch the instance and create one simple test workflow. Confirm that HTTPS, webhooks, persistent storage, and backups work before connecting important systems. Once that foundation is stable, you can expand your automation gradually.
Frequently Asked Questions About Self Hosted n8n
What does self hosting n8n mean?
Self hosting n8n means running n8n on infrastructure that you control. You can use a VPS, cloud server, local computer, or private server. You become responsible for security, storage, updates, backups, and availability.
Is self hosted n8n free?
Yes, you can use n8n Community Edition without a standard Cloud subscription. You may still pay for a VPS, domain, backups, monitoring, or administrator time. Running n8n on hardware you already own can reduce costs for testing.
How do I set up self hosted n8n as a beginner?
A beginner can start with a VPS, Ubuntu, Docker, and Docker Compose. Install n8n with persistent storage, connect a domain, enable HTTPS, and configure the public webhook address. Finish by securing the server and creating a tested backup.
Do I need Docker to self host n8n?
Docker is not the only possible approach, but n8n recommends it for most self hosting needs. Docker reduces operating system compatibility problems and isolates the application environment. Current n8n documentation directs users toward Docker Compose for the recommended setup.
Do I need a domain to self host n8n?
No, a domain is not required for basic local testing. A domain becomes valuable when you need HTTPS, public webhooks, OAuth callbacks, or stable browser access. A subdomain such as n8n.example.com works well for production.
Can I run n8n on my own computer?
Yes, n8n can run locally through Docker Desktop on Windows, macOS, or Linux. Local installation is useful for learning and workflow development. Public webhooks usually require a tunnel or a publicly reachable server.
How much RAM does self hosted n8n need?
There is no fixed RAM requirement for every n8n workload. A small deployment can often begin with roughly 2 GB to 4 GB of RAM. AI workloads, file processing, and high concurrency can require more memory.