{"id":131187,"date":"2025-07-11T09:56:42","date_gmt":"2025-07-11T09:56:42","guid":{"rendered":"\/tutorials\/?p=131187"},"modified":"2025-12-15T04:59:58","modified_gmt":"2025-12-15T04:59:58","slug":"how-to-self-host-n8n-with-docker","status":"publish","type":"post","link":"\/tutorials\/how-to-self-host-n8n-with-docker","title":{"rendered":"How do you run n8n with Docker?"},"content":{"rendered":"<p>Running n8n with Docker is an efficient way to self-host this workflow automation tool. Unlike installing n8n directly on your virtual private server (VPS), Docker offers a containerized environment that isolates n8n from your main system.<\/p><p>This makes it easy to upgrade or downgrade your n8n versions, scale your setup to accommodate more workflows, and even migrate your n8n instance to another server.<\/p><p>In this article, you&rsquo;ll learn how to run n8n using Docker and Docker Compose. This method lets you define the n8n service, environment variables, and dependencies &ndash; such as a database &ndash; in a single YAML file.<\/p><p>Keep reading for step-by-step instructions for installing, configuring, securing, and updating your n8n instance using Docker.<\/p><p>\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-self-host-n8n-with-docker\"><strong>How to self-host n8n with Docker<\/strong><\/h2><p>To self-host n8n with Docker, you&rsquo;ll need to start by installing Docker and Docker Compose on your VPS. Next, you&rsquo;ll need to create a Docker Compose file to configure your n8n service. Finally, you&rsquo;ll have to run the n8n container using the <strong>docker compose up -d<\/strong> command.<\/p><p>Then, you can secure your n8n setup with SSL and a reverse proxy, modify environment variables as needed, and update n8n whenever new versions are released.<\/p><p>The following sections explain each step in more detail.<\/p><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">&#128218; Suggested reading<\/h4>\n                    <p> If you prefer to <a href=\"\/tutorials\/how-to-install-n8n\">install n8n<\/a> directly on your VPS, don&rsquo;t worry. We have a dedicated tutorial to guide you through the process.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-1-install-docker-and-docker-compose\"><strong>1. Install Docker and Docker Compose<\/strong><\/h3><p>First, make sure Docker is set up on your server. Starting with Docker <strong>v20.10.0<\/strong>, Docker Compose is included by default as a plugin, so you don&rsquo;t need to install it separately.<\/p><p>If you use<a href=\"\/vps\/docker-hosting\"> Hostinger&rsquo;s Docker VPS hosting<\/a>, you&rsquo;re in luck &ndash; Docker comes preinstalled, so you can skip this step entirely.<\/p><p>Users with regular Hostinger VPS plans can still<a href=\"\/tutorials\/how-to-install-docker-on-ubuntu\"> install Docker<\/a> either via a preconfigured template or manually through the command line.<\/p><p>If you choose the latter, verify the installation by running the following<a href=\"\/tutorials\/linux-commands\"> Linux command<\/a> in your terminal:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker -v<\/pre><p>This will display the installed Docker version, like this:<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69dfa4339b6ea\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1310\" height=\"204\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-v.png\/public\" alt=\"A terminal output shows the installed Docker version\" class=\"wp-image-131189\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-v.png\/w=1310,fit=scale-down 1310w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-v.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-v.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-v.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-v.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1310px) 100vw, 1310px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Docker-Cheat-Sheet.pdf\" target=\"_blank\" rel=\"noopener\">Download free docker cheat sheet<\/a><\/p><h3 class=\"wp-block-heading\" id=\"h-2-prepare-the-n8n-data-directory\"><strong>2. Prepare the n8n data directory<\/strong><\/h3><p>Next, create directories to store n8n&rsquo;s data and configuration files. Run the command below to create the main directory for n8n and navigate to it:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir ~\/n8n &amp;&amp; cd ~\/n8n<\/pre><p>Inside the newly created directory, create a subdirectory called <strong>n8n_data<\/strong> to store n8n&rsquo;s persistent data:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir n8n_data<\/pre><p>Set the correct ownership for the persistent data, which is important when running n8n with Docker:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo chown -R 1000:1000 n8n_data<\/pre><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69dfa4339da53\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1996\" height=\"286\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-mkdir-chown.png\/public\" alt=\"A terminal output after running the mkdir and chown commands\" class=\"wp-image-131191\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-mkdir-chown.png\/w=1996,fit=scale-down 1996w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-mkdir-chown.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-mkdir-chown.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-mkdir-chown.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-mkdir-chown.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-mkdir-chown.png\/w=1536,fit=scale-down 1536w\" sizes=\"(max-width: 1996px) 100vw, 1996px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-3-create-a-docker-compose-file-for-n8n\"><strong>3. Create a Docker Compose file for n8n<\/strong><\/h3><p>After preparing directories for n8n, create a new Docker Compose file to configure n8n&rsquo;s settings, define environment variables, and specify the necessary volumes.<\/p><p>You can do so by using the<a href=\"\/tutorials\/how-to-install-and-use-nano-text-editor\"> nano text editor<\/a>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano docker-compose.yml<\/pre><p>Paste the following content, replacing <strong>yourUser<\/strong> and <strong>yourPassword<\/strong> with your preferred credentials:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">services:\n\n&nbsp;&nbsp;n8n:\n\n&nbsp;&nbsp;&nbsp;&nbsp;image: n8nio\/n8n\n\n&nbsp;&nbsp;&nbsp;&nbsp;ports:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- \"5678:5678\"\n\n&nbsp;&nbsp;&nbsp;&nbsp;environment:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- N8N_BASIC_AUTH_ACTIVE=true\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- N8N_BASIC_AUTH_USER=yourUser\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- N8N_BASIC_AUTH_PASSWORD=yourPassword\n\n&nbsp;&nbsp;&nbsp;&nbsp;volumes:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- .\/n8n_data:\/home\/node\/.n8n<\/pre><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69dfa4339fd5f\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"2674\" height=\"1624\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-docker-compose-yml.png\/public\" alt=\"The docker-compose.yml file's content\" class=\"wp-image-131192\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-docker-compose-yml.png\/w=2674,fit=scale-down 2674w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-docker-compose-yml.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-docker-compose-yml.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-docker-compose-yml.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-docker-compose-yml.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-docker-compose-yml.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-docker-compose-yml.png\/w=2048,fit=scale-down 2048w\" sizes=\"(max-width: 2674px) 100vw, 2674px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Once done, save your changes and exit <strong>nano<\/strong> by pressing <strong>Ctrl + X &rarr; Y &rarr; Enter<\/strong>.<\/p><h3 class=\"wp-block-heading\" id=\"h-4-start-the-n8n-container\"><strong>4. Start the n8n container<\/strong><\/h3><p>Now, run the n8n container with this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d<\/pre><p>You&rsquo;ll see the container starting process. Once complete, it will display lines like <strong>Created<\/strong> and <strong>Started<\/strong>, similar to the image below:<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69dfa433a3ced\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"2810\" height=\"1460\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-up.png\/public\" alt=\"A terminal output shows a successful Docker container creation process\" class=\"wp-image-131193\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-up.png\/w=2810,fit=scale-down 2810w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-up.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-up.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-up.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-up.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-up.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-up.png\/w=2048,fit=scale-down 2048w\" sizes=\"(max-width: 2810px) 100vw, 2810px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>To verify if your n8n container has started, open the following address in your browser, replacing <strong>your_vps_ip<\/strong> with your own VPS&rsquo; IP address:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/your_vps_ip:5678<\/pre><p>Hostinger VPS customers can find their server&rsquo;s IP in hPanel by going to <strong>VPS &rarr; Manage &rarr; Overview &rarr; VPS details<\/strong>.<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69dfa433a596b\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"2292\" height=\"914\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hpanel-vps-overview-ipv4-highlighted.png\/public\" alt=\"Hostinger hPanel VPS overview iPv4 highlighted\" class=\"wp-image-131194\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hpanel-vps-overview-ipv4-highlighted.png\/w=2292,fit=scale-down 2292w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hpanel-vps-overview-ipv4-highlighted.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hpanel-vps-overview-ipv4-highlighted.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hpanel-vps-overview-ipv4-highlighted.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hpanel-vps-overview-ipv4-highlighted.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hpanel-vps-overview-ipv4-highlighted.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/hpanel-vps-overview-ipv4-highlighted.png\/w=2048,fit=scale-down 2048w\" sizes=\"(max-width: 2292px) 100vw, 2292px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If you see a secure cookie error warning like in the image below when visiting the address, don&rsquo;t worry. Your n8n instance is actually running. The error occurs because SSL is not set up for secure connections, but you&rsquo;ll address this in the next step.<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69dfa433a7333\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"2308\" height=\"1042\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-security-error-warning.png\/public\" alt=\"The n8n security error warning\" class=\"wp-image-131195\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-security-error-warning.png\/w=2308,fit=scale-down 2308w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-security-error-warning.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-security-error-warning.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-security-error-warning.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-security-error-warning.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-security-error-warning.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-security-error-warning.png\/w=2048,fit=scale-down 2048w\" sizes=\"(max-width: 2308px) 100vw, 2308px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-5-secure-n8n-with-ssl-and-an-nginx-reverse-proxy\"><strong>5. Secure n8n with SSL and an NGINX reverse proxy<\/strong><\/h3><p>To securely access your n8n instance via HTTPS, you&rsquo;ll need to issue an SSL certificate and configure a reverse proxy.<\/p><p>First, install the<a href=\"\/tutorials\/what-is-nginx\"> NGINX<\/a> web server on your VPS:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install nginx -y<\/pre><p>Immediately stop the NGINX service temporarily:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl stop nginx<\/pre><p>Next, install Certbot to obtain your SSL certificate:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install certbot -y<\/pre><p>Get a standalone SSL certificate version of Certbot. Replace <strong>yourdomain.tld<\/strong> with your actual domain name if you&rsquo;ve<a href=\"\/tutorials\/how-to-point-domain-to-vps\"> pointed it to your VPS<\/a>. Otherwise, issue an SSL certificate for your hostname:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo certbot certonly --standalone -d yourdomain.tld<\/pre><p>You&rsquo;ll be prompted to enter a valid email address, accept the terms of service, and optionally sign up to receive promotional emails.<\/p><p>Once done, start NGINX again:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl start nginx<\/pre><p>After that, create a configuration file to<a href=\"\/tutorials\/how-to-set-up-nginx-reverse-proxy\"> set up the reverse proxy with NGINX<\/a>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano \/etc\/nginx\/sites-available\/n8n<\/pre><p>Inside the file, paste the configuration details below. Replace <strong>yourdomain.tld<\/strong> with your own domain or hostname.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">server {\n\n&nbsp;&nbsp;&nbsp;&nbsp;listen 443 ssl;\n\n&nbsp;&nbsp;&nbsp;&nbsp;server_name yourdomain.tld;\n\n&nbsp;&nbsp;&nbsp;&nbsp;ssl_certificate \/etc\/letsencrypt\/live\/yourdomain.tld\/fullchain.pem;\n\n&nbsp;&nbsp;&nbsp;&nbsp;ssl_certificate_key \/etc\/letsencrypt\/live\/yourdomain.tld\/privkey.pem;\n\n&nbsp;&nbsp;&nbsp;&nbsp;location \/ {\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_pass http:\/\/localhost:5678;\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_set_header Host $host;\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_set_header X-Real-IP $remote_addr;\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_set_header X-Forwarded-Proto $scheme;\n\n&nbsp;&nbsp;&nbsp;&nbsp;}\n\n}\n\nserver {\n\n&nbsp;&nbsp;&nbsp;&nbsp;listen 80;\n\n&nbsp;&nbsp;&nbsp;&nbsp;server_name yourdomain.tld;\n\n&nbsp;&nbsp;&nbsp;&nbsp;return 301 https:\/\/$host$request_uri;\n\n}<\/pre><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69dfa433a965b\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"2758\" height=\"1534\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-n8n.png\/public\" alt=\"The NGINX configuration file for n8n's content\" class=\"wp-image-131196\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-n8n.png\/w=2758,fit=scale-down 2758w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-n8n.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-n8n.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-n8n.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-n8n.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-n8n.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-nano-n8n.png\/w=2048,fit=scale-down 2048w\" sizes=\"(max-width: 2758px) 100vw, 2758px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>After saving the file and quitting the editor, run this command to enable the configuration:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ln -sf \/etc\/nginx\/sites-available\/n8n \/etc\/nginx\/sites-enabled\/n8n<\/pre><p>Test the NGINX configuration for errors:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nginx -t<\/pre><p>Reload the NGINX service to apply the changes:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl reload nginx<\/pre><h3 class=\"wp-block-heading\" id=\"h-6-access-your-n8n-instance\"><strong>6. Access your n8n instance<\/strong><\/h3><p>Now, visit your n8n instance using the domain or hostname you previously configured. You&rsquo;ll see the n8n owner account registration page, where you can sign up with your preferred credentials.<\/p><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69dfa433ab7b6\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1124\" height=\"1570\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-owner-account.png\/public\" alt=\"The n8n owner account registration page\" class=\"wp-image-131197\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-owner-account.png\/w=1124,fit=scale-down 1124w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-owner-account.png\/w=215,fit=scale-down 215w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-owner-account.png\/w=733,fit=scale-down 733w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-owner-account.png\/w=107,fit=scale-down 107w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-owner-account.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/n8n-owner-account.png\/w=1100,fit=scale-down 1100w\" sizes=\"(max-width: 1124px) 100vw, 1124px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>After that, open the n8n dashboard to start creating automation workflows. You can check out some<a href=\"\/tutorials\/n8n-workflow-examples\"> n8n workflow examples<\/a> for inspiration.<\/p><p>If you don&rsquo;t want to start from scratch, find<a href=\"\/tutorials\/best-n8n-templates\"> n8n templates<\/a> for ready-made solutions.<\/p><p>Don&rsquo;t forget to explore<a href=\"\/tutorials\/n8n-integrations\"> n8n integrations<\/a> to see what you can connect, which tools to use, and the use cases for each integration.<\/p><h3 class=\"wp-block-heading\" id=\"h-7-modify-n8n-environment-variables\"><strong>7. Modify n8n environment variables<\/strong><\/h3><p>When managing your n8n instance, you may need to modify environment variables to set up database connections, enable authentication, integrate third-party services, or enhance security.<\/p><p>To do this, return to your terminal and edit your Docker Compose file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano docker-compose.yml<\/pre><p>Under the <strong>environment<\/strong> section, add or modify configuration settings for your n8n container. Here are some of the most commonly used variables:<\/p><ul class=\"wp-block-list\">\n<li><strong>N8N_ENCRYPTION_KEY<\/strong> &ndash; encrypts credentials in the database for added security.<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">- N8N_ENCRYPTION_KEY=yourStrongRandomString<\/pre><ul class=\"wp-block-list\">\n<li><strong>N8N_HOST<\/strong>, <strong>N8N_PORT<\/strong>, <strong>N8N_PROTOCOL<\/strong> &ndash; ensures n8n generates correct URLs, especially behind a reverse proxy or when using SSL.<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">- N8N_HOST=yourdomain.tld\n\n- N8N_PORT=5678\n\n- N8N_PROTOCOL=https<\/pre><ul class=\"wp-block-list\">\n<li><strong>WEBHOOK_URL<\/strong> &ndash; sets the public URL for webhooks, which is important if you use HTTPS or a custom domain.<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">- WEBHOOK_URL=https:\/\/youdomain.tld<\/pre><ul class=\"wp-block-list\">\n<li><strong>DB_TYPE<\/strong>, <strong>DB_POSTGRESDB<\/strong> &ndash; lets you use PostgreSQL instead of the default SQLite for better performance and scalability.<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">- DB_TYPE=postgresdb\n\n- DB_POSTGRESDB_HOST=your_postgres_host\n\n- DB_POSTGRESDB_PORT=5432\n\n- DB_POSTGRESDB_DATABASE=your_database_name\n\n- DB_POSTGRESDB_USER=your_db_user\n\n- DB_POSTGRESDB_PASSWORD=your_db_password<\/pre><ul class=\"wp-block-list\">\n<li><strong>TZ<\/strong> &ndash; sets the timezone for n8n.<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">- TZ=UTC<\/pre><p>Save the file once you&rsquo;ve made the necessary changes.<\/p><p>Next, run the following Docker command to stop the n8n container:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose down<\/pre><p>Bring the container back up with the updated environment variables:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d<\/pre><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69dfa433ad645\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"2820\" height=\"564\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-down-up.png\/public\" alt=\"A terminal output shows the n8n container recreation process after changing environment variables\" class=\"wp-image-131198\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-down-up.png\/w=2820,fit=scale-down 2820w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-down-up.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-down-up.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-down-up.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-down-up.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-down-up.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-compose-down-up.png\/w=2048,fit=scale-down 2048w\" sizes=\"(max-width: 2820px) 100vw, 2820px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>\n\n<div class=\"protip\">\n                    <h4 class=\"title\">&#128161; Pro tip<\/h4>\n                    <p> If you just want to restart your n8n Docker container without modifying the Compose file, use the <strong>docker compose restart<\/strong> command instead.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-8-update-n8n-to-the-latest-version\"><strong>8. Update n8n to the latest version<\/strong><\/h3><p>You should periodically update n8n to the latest version to minimize security risks and take advantage of new features and improvements.<\/p><p>To update, first pull the latest n8n image from Docker Hub:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker pull n8nio\/n8n<\/pre><p>Then, restart the n8n container with the updated image:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d<\/pre><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"69dfa433af680\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"2804\" height=\"620\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-pull-compose-up.png\/public\" alt=\"A terminal output shows the process of updating the n8n container\" class=\"wp-image-131199\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-pull-compose-up.png\/w=2804,fit=scale-down 2804w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-pull-compose-up.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-pull-compose-up.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-pull-compose-up.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-pull-compose-up.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-pull-compose-up.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/07\/terminal-docker-pull-compose-up.png\/w=2048,fit=scale-down 2048w\" sizes=\"(max-width: 2804px) 100vw, 2804px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-what-are-the-best-practices-for-managing-n8n-with-docker\"><strong>What are the best practices for managing n8n with Docker?<\/strong><\/h2><p>Here are some best practices for managing n8n with Docker, including some already demonstrated in this tutorial:<\/p><ul class=\"wp-block-list\">\n<li><strong>Mount Docker volumes<\/strong>. Mount a host directory like <strong>.\/n8n_data:\/home\/node\/.n8n<\/strong> to persist workflows, credentials, and execution data outside the container. This ensures your data survives updates, restarts, or container recreation.<\/li>\n\n\n\n<li><strong>Configure environment variables<\/strong>. In <strong>docker-compose.yml<\/strong>, set API keys, webhook secrets, database credentials, and other sensitive data as environment variables. This keeps secrets out of workflows and source code, improving security and simplifying key rotation.<\/li>\n\n\n\n<li><strong>Secure access<\/strong>. Always enable basic authentication (<strong>N8N_BASIC_AUTH_ACTIVE=true<\/strong>) and use strong usernames and passwords. For secure communication, place n8n behind a reverse proxy like NGINX with SSL so that all data, including credentials, is encrypted and not sent in plain text.<\/li>\n\n\n\n<li><strong>Perform regular backups.<\/strong> Periodically back up the host folder mapped to <strong>\/home\/node\/.n8n<\/strong>, not the container&rsquo;s internal path. For a running container, use the command below:<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker cp n8n:\/home\/node\/.n8n \/path\/to\/backup\/folder<\/pre><ul class=\"wp-block-list\">\n<li><strong>Set resource limits.<\/strong> In your <strong>docker-compose.yml <\/strong>file, set CPU and memory limits to prevent n8n from overusing your VPS resources. For example:<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">deploy:\n  resources:\n    limits:\n      cpus: '1'\n      memory: 1G<\/pre><ul class=\"wp-block-list\">\n<li><strong>Monitor logs and performance.<\/strong> Run <strong>docker compose logs n8n<\/strong> to review logs and troubleshoot issues. For ongoing monitoring, consider integrating with a system like the<a href=\"\/tutorials\/how-to-set-up-lgtm-stack\"> LGTM stack<\/a> to receive alerts if n8n is down or misbehaving.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-why-is-hostinger-the-best-way-to-host-your-n8n-docker-setup\"><strong>Why is Hostinger the best way to host your n8n Docker setup?<\/strong><\/h3><p>Docker makes self-hosting n8n easy and flexible by providing a portable, consistent environment across systems. But to keep it running reliably 24\/7, you can&rsquo;t rely on your personal machine &ndash; <strong>you need a VPS<\/strong>.<\/p><p>A VPS runs continuously, so your workflows stay active even when your computer is off or disconnected. It also lets you access and manage n8n securely from anywhere, not just your local network.<\/p><p>Hostinger&rsquo;s Docker VPS is an excellent choice for self-hosting containerized apps like n8n. Docker and all required components come preinstalled, so you can deploy n8n quickly without extra setup.<\/p><p>We offer multiple data centers across regions, so you can choose a server closer to you for minimal latency. Plus, with Hostinger&rsquo;s <strong>99.9%<\/strong> uptime guarantee, your automation workflows stay online reliably around the clock.<\/p><p>Starting from <strong>$6.49\/month<\/strong>, our Docker VPS plans include up to <strong>8<\/strong> vCPU cores, <strong>32 GB<\/strong> of RAM, and <strong>400 GB<\/strong> of NVMe storage. You can start small and upgrade to a higher plan in just a few clicks as your automation needs grow.<\/p><p>Security is a priority, with automatic backups, advanced DDoS protection, and a malware scanner to keep your data safe, block attacks, and prevent disruptions to your n8n setup.<\/p><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/public\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-what-s-next-after-self-hosting-n8n-with-docker\"><strong>What&rsquo;s next after self-hosting n8n with Docker?<\/strong><\/h2><p>Self-hosting n8n with Docker gives you full control, flexibility, and scalability for your workflow automation. It lets you run a powerful automation tool on your own terms &ndash; securely, reliably, and with room to grow.<\/p><p>As you continue building and managing your n8n setup, here&rsquo;s what you can do next:<\/p><ul class=\"wp-block-list\">\n<li><strong>Explore automation ideas<\/strong>. Discover<a href=\"\/tutorials\/what-can-you-automate-with-n8n\"> what you can automate with n8n<\/a> to get inspired and streamline repetitive tasks.<\/li>\n\n\n\n<li><strong>Scale your n8n setup<\/strong>.<a href=\"\/tutorials\/how-to-deploy-a-docker-stack\"> Deploy a Docker stack<\/a> to scale n8n across multiple servers and manage services in a swarm cluster.<\/li>\n\n\n\n<li><strong>Secure your server<\/strong>. Follow<a href=\"\/tutorials\/vps-security\"> VPS security<\/a> best practices, such as changing the SSH port, disabling root login, and setting up a firewall, to protect your n8n instance.<\/li>\n\n\n\n<li><strong>Use n8n with MCP<\/strong>. Expose your workflows to AI agents and enable context-aware automation by<a href=\"\/tutorials\/how-to-use-n8n-with-mcp\"> integrating n8n with model context protocol (MCP)<\/a>.<\/li>\n<\/ul><p>If you still have any questions about running and managing n8n with Docker, feel free to leave a comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Running n8n with Docker is an efficient way to self-host this workflow automation tool. Unlike installing n8n directly on your [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/tutorials\/how-to-self-host-n8n-with-docker\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":411,"featured_media":64047,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to self-host n8n with Docker","rank_math_description":"How to self-host n8n with Docker: 1. Install Docker and Docker Compose \u00b7 2. Prepare the n8n data directory \u00b7 3. Create a Docker Compose file for n8n, and more","rank_math_focus_keyword":"n8n docker","footnotes":""},"categories":[22644,22646],"tags":[],"class_list":["post-131187","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps","category-pre-installed-applications"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-self-host-n8n-with-docker","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/n8n-docker","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/executer-n8n-avec-docker","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/como-instalar-n8n-en-docker","default":0},{"locale":"de-DE","link":"https:\/\/www.hostinger.com\/de\/tutorials\/n8n-docker-hosting","default":0},{"locale":"it-IT","link":"https:\/\/www.hostinger.com\/it\/tutorial\/come-ospitare-n8n-con-docker","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-self-host-n8n-with-docker","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-self-host-n8n-with-docker","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-self-host-n8n-with-docker","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-self-host-n8n-with-docker","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-self-host-n8n-with-docker","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/como-instalar-n8n-en-docker","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/como-instalar-n8n-en-docker","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/como-instalar-n8n-en-docker","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/n8n-docker","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-self-host-n8n-with-docker","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-self-host-n8n-with-docker","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/131187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/users\/411"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/comments?post=131187"}],"version-history":[{"count":4,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/131187\/revisions"}],"predecessor-version":[{"id":131203,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/131187\/revisions\/131203"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media\/64047"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media?parent=131187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/categories?post=131187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/tags?post=131187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}