{"id":14220,"date":"2025-11-06T10:43:35","date_gmt":"2025-11-06T10:43:35","guid":{"rendered":"https:\/\/www.ssdnodes.com\/?p=14220"},"modified":"2025-12-25T18:58:40","modified_gmt":"2025-12-25T18:58:40","slug":"easiest-way-to-install-and-deploy-n8n-on-a-vps-with-https","status":"publish","type":"post","link":"https:\/\/www.ssdnodes.com\/blog\/easiest-way-to-install-and-deploy-n8n-on-a-vps-with-https\/","title":{"rendered":"Easiest Way to Install and Deploy n8n on a VPS with HTTPS"},"content":{"rendered":"<p>Setting up n8n on a VPS might seem complex at first, but it's actually surprisingly straightforward! Thanks to Docker and Caddy, you can quickly deploy a production-ready n8n instance with automatic HTTPS encryption in just a few minutes.<\/p>\n<p>In this comprehensive installation guide, you'll learn how to install n8n on a VPS using Docker, configure automatic SSL certificates with Caddy, and get your workflow automation platform running securely.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14234\" style=\"border-radius: 25px;\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/Easiest-way-to-install-n8n-on-a-VPS-1.webp\" alt=\"Easiest Way to Install and Deploy n8n on a VPS\" width=\"600\" height=\"400\" \/><\/p>\n<h2>Easiest Way to Install and Deploy n8n on a VPS with HTTPS<\/h2>\n<p>If you're looking for the fastest way to get n8n VPS hosting up and running on Ubuntu 24.04, here are the essential commands:<\/p>\n<pre><code class=\"language-bash\"># Install Docker (follow official Docker docs)\r\nsudo apt update\r\n\r\n# Create n8n data volume\r\ndocker volume create n8n_data\r\n\r\n# Run n8n container\r\ndocker run -d --rm \\\r\n --name n8n \\\r\n -p 5678:5678 \\\r\n -e GENERIC_TIMEZONE=\"America\/New_York\" \\\r\n -e TZ=\"America\/New_York\" \\\r\n -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \\\r\n -e N8N_RUNNERS_ENABLED=true \\\r\n -e VUE_APP_URL_BASE_API=https:\/\/n8n.yourdomain.com\/ \\\r\n -e N8N_EDITOR_BASE_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -e WEBHOOK_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -e WEBHOOK_BASE_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -e WEBHOOK_TUNNEL_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -v n8n_data:\/home\/node\/.n8n \\\r\n docker.n8n.io\/n8nio\/n8n\r\n\r\n# Install and configure Caddy\r\nsudo apt install caddy\r\nsudo nano \/etc\/caddy\/Caddyfile  # Add your configuration\r\nsudo systemctl restart caddy<\/code><\/pre>\n<p>Using Caddy and Docker is the easiest way to install and deploy n8n. For detailed instructions, including configuration options and troubleshooting tips for how to install n8n on VPS, continue reading below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14235\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/Install-n8n-with-Docker-1.webp\" alt=\"Install n8n with Docker\" width=\"576\" height=\"437\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/Install-n8n-with-Docker-1.webp 576w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/Install-n8n-with-Docker-1-300x228.webp 300w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/p>\n<h2>What is n8n VPS?<\/h2>\n<p>Before diving into the installation, let's quickly clarify what n8n means. n8n is a powerful, open-source workflow automation tool that lets you connect different apps and services together. When you deploy n8n on a VPS (Virtual Private Server), you get complete control over your automation platform, with full data privacy, customization options, and the ability to scale as your needs grow.<\/p>\n<p>Unlike cloud-hosted solutions, a VPS gives you total ownership of your data and workflows, making it perfect for businesses with specific security requirements or those who want to avoid recurring subscription costs.<\/p>\n<h2>n8n VPS Requirements<\/h2>\n<p>To follow this tutorial and successfully install n8n on a VPS, you'll need:<\/p>\n<ul>\n<li><strong>Ubuntu 24.04<\/strong>\u00a0with root or sudo access (If you haven't noticed, <a href=\"https:\/\/ssdnodes.com\/\" target=\"_blank\" rel=\"noopener\">SSD Nodes<\/a> offers the most affordable and reliable Ubuntu servers in the world. Our NVMe VPS options provide lightning-fast performance for your n8n workflows). You can follow this <a href=\"https:\/\/www.ssdnodes.com\/blog\/connecting-vps-ssh-security\/\">SSH guide to connect to your VPS<\/a>.<\/li>\n<li><strong>Domain name<\/strong> pointing to your server's IP address (e.g., <code>n8n.yourdomain.com<\/code>)<\/li>\n<li><strong>Open firewall ports<\/strong>: 80 (HTTP), 443 (HTTPS), and 5678 (n8n default port)<\/li>\n<li>Basic familiarity with command-line operations<\/li>\n<\/ul>\n<p><strong>Note:<\/strong> Before proceeding with the installation, ensure that TCP ports 80, 443, and 5678 are open on your <a href=\"https:\/\/www.ssdnodes.com\/blog\/introducing-firewall-groups-for-simpler-server-security\/\">server's firewall<\/a>. Port 80 allows the initial domain verification for SSL certificates, port 443 is needed for serving encrypted <a href=\"https:\/\/www.ssdnodes.com\/blog\/what-is-the-purpose-of-the-http-protocol\/\">HTTPS traffic<\/a>, and port 5678 is n8n's default application port.<\/p>\n<h2 class=\"text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold\">Understanding n8n webhook_tunnel_url Meaning<\/h2>\n<p class=\"font-claude-response-body break-words whitespace-normal leading-[1.7]\">Before we start with the easiest way to deploy n8n on a VPS, you'll first need to understand the meaning of <code class=\"bg-text-200\/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]\">webhook_tunnel_url<\/code> in n8n. This configuration setting is crucial for testing and development workflows.<\/p>\n<p class=\"font-claude-response-body break-words whitespace-normal leading-[1.7]\">The <code class=\"bg-text-200\/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]\">webhook_tunnel_url<\/code> is an n8n environment variable that enables webhook functionality during local development or testing phases. When you're building automation workflows that rely on external services sending data to your n8n instance via webhooks, the <code class=\"bg-text-200\/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]\">webhook_tunnel_url<\/code> creates a publicly accessible URL that tunnels to your local or development environment.<\/p>\n<p class=\"font-claude-response-body break-words whitespace-normal leading-[1.7]\">In a production VPS deployment with a proper domain and HTTPS (which we'll cover in this guide), you typically won't need to configure the <code class=\"bg-text-200\/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]\">webhook_tunnel_url<\/code> since your n8n instance will already be accessible via your domain name. However, understanding this concept helps you troubleshoot webhook-related issues and appreciate why having a proper VPS deployment with a dedicated domain is the superior approach for production workflows.<\/p>\n<p class=\"font-claude-response-body break-words whitespace-normal leading-[1.7]\">The <code class=\"bg-text-200\/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]\">webhook_tunnel_url<\/code> becomes particularly relevant when you're developing locally and need to test webhooks from services like Stripe, GitHub, or Slack before deploying to your VPS. Once your n8n instance is running on a VPS with HTTPS (as we'll show you), your actual domain becomes your webhook URL, eliminating the need for tunnel configurations.<\/p>\n<p>Now let's get to deploying n8n!<\/p>\n<h2>Step 1: Install Docker on Your VPS<\/h2>\n<p>To run n8n on your server efficiently, you'll use Docker, which provides a clean, isolated environment for your n8n instance. First, update your package repositories to ensure you're working with the latest available software:<\/p>\n<pre><code class=\"language-bash\">sudo apt update<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14226\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/sudo-apt-update.webp\" alt=\"updating packages before installing n8n\" width=\"709\" height=\"190\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/sudo-apt-update.webp 709w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/sudo-apt-update-300x80.webp 300w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/p>\n<p>Next, follow the official instructions from Docker to <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\" target=\"_blank\" rel=\"noopener\">install Docker Engine<\/a>. Docker's official documentation provides the most up-to-date and reliable installation method for Ubuntu 24.04.<\/p>\n<p>After Docker is installed, add your user to the docker group (optional, but recommended to run docker without sudo):<\/p>\n<pre><code class=\"language-bash\">sudo usermod -aG docker $USER\r\nnewgrp docker<\/code><\/pre>\n<p>This step allows you to run Docker commands without needing sudo every time, making your workflow more efficient.<\/p>\n<p>Now, start and enable Docker to run automatically on system boot:<\/p>\n<pre><code class=\"language-bash\">sudo systemctl start docker\r\nsudo systemctl enable docker<\/code><\/pre>\n<p>You can verify Docker is running correctly by checking its status:<\/p>\n<p><code class=\"language-bash\">sudo systemctl status docker<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14236\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/sudo-systemctl-enable-docker-1.webp\" alt=\"Docker status\" width=\"700\" height=\"227\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/sudo-systemctl-enable-docker-1.webp 903w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/sudo-systemctl-enable-docker-1-300x97.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/sudo-systemctl-enable-docker-1-768x249.webp 768w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/p>\n<h2>Step 2: Run n8n with Docker<\/h2>\n<p>Now that Docker is installed, it's time to deploy n8n on your VPS. First, create a persistent volume for n8n data. This ensures your workflows, credentials, and settings are preserved even if the container is stopped or restarted:<\/p>\n<pre><code class=\"language-bash\">docker volume create n8n_data<\/code><\/pre>\n<p>Next, run the n8n container with all necessary configuration. We'll start with an interactive mode first to verify everything works:<\/p>\n<pre><code class=\"language-bash\">docker run -it --rm \\\r\n --name n8n \\\r\n -p 5678:5678 \\\r\n -e GENERIC_TIMEZONE=\"America\/New_York\" \\\r\n -e TZ=\"America\/New_York\" \\\r\n -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \\\r\n -e N8N_RUNNERS_ENABLED=true \\\r\n -e VUE_APP_URL_BASE_API=https:\/\/n8n.yourdomain.com\/ \\\r\n -e N8N_EDITOR_BASE_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -e WEBHOOK_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -e WEBHOOK_BASE_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -e WEBHOOK_TUNNEL_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -v n8n_data:\/home\/node\/.n8n \\\r\n docker.n8n.io\/n8nio\/n8n<\/code><\/pre>\n<p><strong>Important:<\/strong> Replace <code>\"America\/New_York\"<\/code> with your timezone. Find yours from this <a href=\"https:\/\/en.wikipedia.org\/wiki\/List_of_tz_database_time_zones#List\" target=\"_blank\" rel=\"noopener\">page<\/a>. Also, replace <code>n8n.yourdomain.com<\/code> with your actual domain name throughout all the environment variables.<\/p>\n<p>You should see output indicating that the editor is now accessible:<\/p>\n<pre><code>Editor is now accessible via:\r\nhttp:\/\/localhost:5678<\/code><\/pre>\n<p>This interactive mode (<code>-it<\/code>) is useful for testing, but for production n8n VPS hosting, you'll want to run the container in detached mode. Stop the current container (Ctrl+C) and run it again with the <code>-d<\/code> flag:<\/p>\n<pre><code class=\"language-bash\">docker run -d --rm \\\r\n --name n8n \\\r\n -p 5678:5678 \\\r\n -e GENERIC_TIMEZONE=\"America\/New_York\" \\\r\n -e TZ=\"America\/New_York\" \\\r\n -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \\\r\n -e N8N_RUNNERS_ENABLED=true \\\r\n -e VUE_APP_URL_BASE_API=https:\/\/n8n.yourdomain.com\/ \\\r\n -e N8N_EDITOR_BASE_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -e WEBHOOK_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -e WEBHOOK_BASE_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -e WEBHOOK_TUNNEL_URL=https:\/\/n8n.yourdomain.com\/ \\\r\n -v n8n_data:\/home\/node\/.n8n \\\r\n docker.n8n.io\/n8nio\/n8n<\/code><\/pre>\n<p>You should receive a container ID similar to this:<\/p>\n<pre><code>af1eb22262acc60fc205b80e57ad76b3c50909f83d0036e4921db517ba95ec6f<\/code><\/pre>\n<p>This long alphanumeric string is your container's unique identifier, confirming that n8n is now running in the background.<\/p>\n<p>To verify that n8n is running correctly, test it with curl:<\/p>\n<pre><code class=\"language-bash\">curl localhost:5678<\/code><\/pre>\n<p>You'll see output that mentions JavaScript is required, which is perfectly normal and indicates n8n is responding:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14230\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/n8n-is-successfully-running.jpg\" alt=\"n8n is successfully running on a VPS\" width=\"700\" height=\"207\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/n8n-is-successfully-running.jpg 1024w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/n8n-is-successfully-running-300x89.jpg 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/n8n-is-successfully-running-768x227.jpg 768w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/p>\n<p>This confirms that n8n is successfully running on port 5678 and ready to be accessed through a web browser.<\/p>\n<h2>Step 3: Install and Configure Caddy for Automatic HTTPS<\/h2>\n<p>Now that n8n is running, you need to set up HTTPS to secure your connection. Caddy makes this incredibly easy by automatically obtaining and renewing Let's Encrypt SSL certificates. This is one of the key advantages of this easy n8n deployment method.<\/p>\n<p>First, install Caddy:<\/p>\n<pre><code class=\"language-bash\">sudo apt update\r\nsudo apt install caddy\r\ncaddy version<\/code><\/pre>\n<p>The <code>caddy version<\/code> command confirms that Caddy is installed correctly and shows you which version you're running:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14228\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/Caddy-version.jpg\" alt=\"Caddy version\" width=\"680\" height=\"221\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/Caddy-version.jpg 680w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/Caddy-version-300x98.jpg 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/p>\n<p>Next, configure Caddy to reverse proxy requests to your n8n instance and handle SSL certificates automatically. Open the Caddyfile:<\/p>\n<pre><code class=\"language-bash\">sudo nano \/etc\/caddy\/Caddyfile<\/code><\/pre>\n<p>Add this configuration at the top of the file:<\/p>\n<pre><code>{\r\n    email your-email@example.com\r\n}\r\nn8n.yourdomain.com {\r\n    reverse_proxy localhost:5678\r\n}<\/code><\/pre>\n<p><strong>Important:<\/strong> Replace <code>your-email@example.com<\/code> with your actual email address (this is used by Let's Encrypt to send certificate expiration notices) and <code>n8n.yourdomain.com<\/code> with your actual domain name.<\/p>\n<p>Your complete Caddyfile configuration should look like this:<\/p>\n<pre><code>{\r\n    email your-email@example.com\r\n}\r\n:80 {\r\n    # Set this path to your site's directory.\r\n    root * \/usr\/share\/caddy\r\n    # Enable the static file server.\r\n    file_server\r\n    # Another common task is to set up a reverse proxy:\r\n    # reverse_proxy localhost:8080\r\n    # Or serve a PHP site through php-fpm:\r\n    # php_fastcgi localhost:9000\r\n}\r\nn8n.yourdomain.com {\r\n    reverse_proxy localhost:5678\r\n}<\/code><\/pre>\n<p>Save and close the file (Ctrl+X, then Y, then Enter in nano).<\/p>\n<h2>Step 4: Start Caddy and Enable Automatic HTTPS<\/h2>\n<p>With your Caddyfile configured, it's time to start Caddy and let it work its magic. Enable and restart Caddy:<\/p>\n<pre><code class=\"language-bash\">sudo systemctl restart caddy\r\nsudo systemctl enable caddy<\/code><\/pre>\n<p>The <code>restart<\/code> command applies your new configuration, while <code>enable<\/code> ensures Caddy starts automatically when your server reboots.<\/p>\n<p>Check if everything is working correctly:<\/p>\n<pre><code class=\"language-bash\">sudo systemctl status caddy<\/code><\/pre>\n<p>You should see output indicating that Caddy is active and running:<\/p>\n<pre><code>\u25cf caddy.service - Caddy\r\n     Loaded: loaded (\/usr\/lib\/systemd\/system\/caddy.service; enabled)\r\n     Active: active (running) <\/code><\/pre>\n<p>If you see \"active (running)\" in green text, congratulations! Caddy is now running and has automatically obtained an SSL certificate for your domain.<\/p>\n<h2>Step 5: Access Your n8n Instance with HTTPS<\/h2>\n<p>Now for the moment of truth! Visit <code>https:\/\/n8n.yourdomain.com<\/code> in your browser (remember to replace with your actual domain name).<\/p>\n<p>You should see:<\/p>\n<ul>\n<li><strong>Automatic HTTPS<\/strong> with a green lock icon in your browser's address bar.<\/li>\n<li><strong>n8n login\/setup page<\/strong> ready for you to create your first account<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-14232\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/n8n-Installed-on-a-VPS-with-Docker-and-Caddy-1024x518.webp\" alt=\"n8n successfully running on a VPS with HTTPS\" width=\"700\" height=\"354\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/n8n-Installed-on-a-VPS-with-Docker-and-Caddy-1024x518.webp 1024w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/n8n-Installed-on-a-VPS-with-Docker-and-Caddy-300x152.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/n8n-Installed-on-a-VPS-with-Docker-and-Caddy-768x388.webp 768w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/n8n-Installed-on-a-VPS-with-Docker-and-Caddy.webp 1298w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/p>\n<p>Congratulations! You've successfully deployed n8n on your VPS with automatic HTTPS encryption. Your workflow automation platform is now secure, production-ready, and accessible from anywhere in the world.<\/p>\n<h2>Troubleshooting Common n8n VPS Installation Issues<\/h2>\n<p>Even with the easiest way to deploy n8n on a VPS, you might occasionally run into issues. Here are solutions to the most common problems:<\/p>\n<h3>502 Bad Gateway Error<\/h3>\n<p>If you see a 502 Bad Gateway error when accessing your domain:<\/p>\n<ul>\n<li><strong>Check if n8n is running:<\/strong> <code>docker ps<\/code> (you should see the n8n container listed)<\/li>\n<li><strong>Check Caddy logs:<\/strong> <code>sudo journalctl -u caddy -f<\/code> (look for error messages)<\/li>\n<li><strong>Verify DNS:<\/strong> <code>dig n8n.yourdomain.com<\/code> (ensure your domain points to the correct IP address)<\/li>\n<\/ul>\n<h3>Certificate Issues<\/h3>\n<p>If HTTPS isn't working or you see certificate warnings:<\/p>\n<ul>\n<li><strong>Ensure your domain points to the correct IP<\/strong> (DNS propagation can take up to 48 hours)<\/li>\n<li><strong>Check ports 80 and 443 are open:<\/strong> <code>sudo ufw allow 80 &amp;&amp; sudo ufw allow 443<\/code><\/li>\n<li><strong>Verify the email in Caddyfile is valid<\/strong> (Let's Encrypt uses this for important notifications)<\/li>\n<\/ul>\n<h3>n8n Not Starting<\/h3>\n<p>If n8n refuses to start or crashes immediately:<\/p>\n<ul>\n<li><strong>Check Docker logs:<\/strong> <code>docker logs n8n<\/code> (this shows detailed error messages)<\/li>\n<li><strong>Ensure timezone is correct<\/strong> (invalid timezones can cause startup failures)<\/li>\n<li><strong>Verify port 5678 isn't blocked<\/strong> by your firewall or already in use by another application<\/li>\n<\/ul>\n<h2>Running n8n as a Permanent Service (Recommended)<\/h2>\n<p>The docker run command above uses the <code>--rm<\/code> flag, which means the container is removed when it stops. For a production n8n VPS setup, you'll want n8n to run permanently and restart automatically if it crashes or your server reboots.<\/p>\n<p>The best way to achieve this is using Docker Compose. Create a docker-compose file:<\/p>\n<pre><code class=\"language-bash\">nano docker-compose.yml<\/code><\/pre>\n<p>Add the following configuration:<\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\r\nservices:\r\n  n8n:\r\n    image: docker.n8n.io\/n8nio\/n8n\r\n    container_name: n8n\r\n    restart: unless-stopped\r\n    ports:\r\n      - \"5678:5678\"\r\n    environment:\r\n      - GENERIC_TIMEZONE=America\/New_York\r\n      - TZ=America\/New_York\r\n      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true\r\n      - N8N_RUNNERS_ENABLED=true\r\n      - VUE_APP_URL_BASE_API=https:\/\/n8n.yourdomain.com\/\r\n      - N8N_EDITOR_BASE_URL=https:\/\/n8n.yourdomain.com\/\r\n      - WEBHOOK_URL=https:\/\/n8n.yourdomain.com\/\r\n      - WEBHOOK_BASE_URL=https:\/\/n8n.yourdomain.com\/\r\n      - WEBHOOK_TUNNEL_URL=https:\/\/n8n.yourdomain.com\/\r\n    volumes:\r\n      - n8n_data:\/home\/node\/.n8n\r\nvolumes:\r\n  n8n_data:\r\n    external: true<\/code><\/pre>\n<p>Remember to replace the timezone and domain name with your actual values.<\/p>\n<p>Now, if you're currently running n8n with the docker run command, stop it first:<\/p>\n<pre><code class=\"language-bash\">docker stop n8n<\/code><\/pre>\n<p>Then start n8n using Docker Compose:<\/p>\n<pre><code class=\"language-bash\">docker compose up -d<\/code><\/pre>\n<p>With this configuration, n8n will automatically restart if it crashes and will start automatically when your server reboots, ensuring maximum uptime for your workflows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14229\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/docker-compose-up-d.webp\" alt=\"running n8n on a VPS with Docker Compose\" width=\"680\" height=\"221\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/docker-compose-up-d.webp 680w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2025\/10\/docker-compose-up-d-300x98.webp 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/p>\n<h2>What You've Accomplished<\/h2>\n<p>By following this guide, you've successfully:<\/p>\n<ul>\n<li>\u2705 <strong>Deployed n8n in Docker<\/strong> with persistent data storage<\/li>\n<li>\u2705 <strong>Configured automatic HTTPS<\/strong> with Let's Encrypt via Caddy<\/li>\n<li>\u2705 <strong>Set up auto-renewing SSL certificates<\/strong> (no manual renewals needed!)<\/li>\n<li>\u2705 <strong>Created a professional subdomain setup<\/strong> for clean, branded access<\/li>\n<li>\u2705 <strong>Built a secure, production-ready deployment<\/strong> that can scale with your needs<\/li>\n<\/ul>\n<p>Your n8n VPS installation is now complete! You can now securely create and run workflow automations, integrate hundreds of different services, and maintain complete control over your data. With automatic HTTPS and persistent storage, you have a robust foundation for building powerful automation workflows.<\/p>\n<h2>FAQ<\/h2>\n<h3>Can I install n8n on a VPS?<\/h3>\n<p>Absolutely! In fact, installing n8n on a VPS is one of the best ways to run n8n. It gives you complete control over your data, allows for unlimited workflows and executions (compared to cloud-hosted plans), and lets you customize your installation exactly how you need it. This tutorial shows you the easiest way to deploy n8n on VPS using Docker and Caddy.<\/p>\n<h3>What are the minimum n8n VPS requirements?<\/h3>\n<p>For basic n8n usage, you'll need at least 1GB of RAM and 10GB of storage. However, for production use, we recommend at least 2GB of RAM and 20GB of storage. The exact requirements depend on the complexity and frequency of your workflows. If you're running many simultaneous workflows or handling large amounts of data, consider upgrading to a more powerful VPS.<\/p>\n<h3>Is n8n VPS hosting more affordable than cloud options?<\/h3>\n<p>Yes, hosting n8n on your own VPS is typically much more cost-effective than cloud-hosted plans, especially as your usage grows. With a VPS, you pay a fixed monthly fee regardless of the number of workflows or executions. Plus, you get complete data ownership and privacy. Check out our affordable VPS options designed specifically for applications like n8n.<\/p>\n<h3>How do I secure my n8n VPS installation?<\/h3>\n<p>This tutorial already includes automatic HTTPS via Let's Encrypt, which encrypts all traffic to your n8n instance. Additionally, make sure to: create a strong password for your n8n account, keep Docker and your VPS updated with security patches, configure firewall rules to only allow necessary ports, and consider setting up automated backups of your n8n_data volume.<\/p>\n<h3>How do I backup my n8n workflows and data?<\/h3>\n<p>Your n8n data is stored in the Docker volume named <code>n8n_data<\/code>. You can back up this volume using Docker commands or by backing up the volume's location on disk (typically <code>\/var\/lib\/docker\/volumes\/n8n_data<\/code>). For automated backups, consider setting up a cron job that regularly copies this data to a secure location or cloud storage service.<\/p>\n<h3>What happens when my Let's Encrypt certificate expires?<\/h3>\n<p>Nothing! That's the beauty of using Caddy for your n8n VPS hosting. Caddy automatically renews your Let's Encrypt certificates before they expire (typically renewing at 30 days before expiration for 90-day certificates). You don't need to do anything manually. Just ensure your server stays online and connected to the internet, and Caddy handles the rest.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Automate your workflows the smart way. Discover the easiest method to install and secure n8n on your VPS with Docker and Caddy \u2014 no more manual SSL headaches!<\/p>\n","protected":false},"author":19,"featured_media":14300,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[18,30],"tags":[],"class_list":["post-14220","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-tutorials"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/14220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/comments?post=14220"}],"version-history":[{"count":14,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/14220\/revisions"}],"predecessor-version":[{"id":15026,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/14220\/revisions\/15026"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media\/14300"}],"wp:attachment":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media?parent=14220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/categories?post=14220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/tags?post=14220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}