{"id":21861,"date":"2026-11-09T20:42:59","date_gmt":"2026-11-09T17:42:59","guid":{"rendered":"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/"},"modified":"2026-11-09T20:42:59","modified_gmt":"2026-11-09T17:42:59","slug":"how-to-install-n8n","status":"publish","type":"post","link":"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/","title":{"rendered":"How to Install n8n: Self-Hosted Setup with Docker Compose on Ubuntu"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_89 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#Requirements\" >Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#1_Install_Docker_and_Docker_Compose\" >1. Install Docker and Docker Compose<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#2_Point_a_Subdomain_to_the_Server_DNS\" >2. Point a Subdomain to the Server (DNS)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#3_Project_Folder_and_env_File\" >3. Project Folder and .env File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#4_Shared_Files_Folder\" >4. Shared Files Folder<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#5_The_composeyaml_File\" >5. The compose.yaml File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#6_Open_the_Firewall\" >6. Open the Firewall<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#7_Start_n8n\" >7. Start n8n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#How_to_Update_n8n\" >How to Update n8n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#Backups_and_Database\" >Backups and Database<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#Troubleshooting\" >Troubleshooting<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#Frequently_Asked_Questions\" >Frequently Asked Questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#Is_self-hosting_n8n_free\" >Is self-hosting n8n free?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/sunucun.com.tr\/blog\/how-to-install-n8n\/#Can_I_use_the_n8n_tunnel_on_a_server\" >Can I use the n8n tunnel on a server?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n<p class=\"wp-block-paragraph\"><strong>n8n<\/strong> is a workflow automation tool that connects apps and services, and you can host it on your own server. This guide shows how to install n8n on a Linux server (for example an Ubuntu <a href=\"https:\/\/sunucun.com.tr\/vds-sunucu\" data-internallinksmanager029f6b8e52c=\"133\" title=\"Tahsisli kaynakl\u0131 sanal sunucu \u00e7\u00f6z\u00fcmleri\">VDS<\/a>) with <strong>Docker Compose<\/strong>, serve it over <strong>HTTPS<\/strong> on your own domain, update it and back it up. The commands and files follow the &#8220;Docker Compose&#8221; installation in n8n&#8217;s official documentation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> n8n&#8217;s own documentation recommends self-<a href=\"https:\/\/sunucun.com.tr\/hosting\/\" data-internallinksmanager029f6b8e52c=\"126\" title=\"Web bar\u0131nd\u0131rma paketlerini inceleyin\">hosting<\/a> for users experienced with servers, containers and security; mistakes can lead to data loss, security issues and downtime.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Requirements\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A Linux server (Ubuntu in this guide) with root\/sudo access and a static public IP<\/li>\n<li>A domain name and access to its DNS records (for example <code>n8n.example.com<\/code>)<\/li>\n<li>TCP ports 80 and 443 open on the server (for the SSL certificate and web access)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Install_Docker_and_Docker_Compose\"><\/span>1. Install Docker and Docker Compose<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Install Docker Engine and the Compose plugin with the steps on Docker&#8217;s official <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\" target=\"_blank\" rel=\"noopener\">Ubuntu install page<\/a>, then check both:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker --version\ndocker compose version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Optional: to run Docker without <code>sudo<\/code>, add your user to the <code>docker<\/code> group:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo usermod -aG docker ${USER}\nexec sg docker newgrp\ngroups<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Point_a_Subdomain_to_the_Server_DNS\"><\/span>2. Point a Subdomain to the Server (DNS)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"snc-table-wrap\"><table>\n<thead><tr><th>Record type<\/th><th>Name<\/th><th>Destination<\/th><\/tr><\/thead>\n<tbody>\n<tr><td>A<\/td><td><code>n8n<\/code> (or your subdomain)<\/td><td>Your server&#8217;s IP address<\/td><\/tr>\n<\/tbody><\/table><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Wait for the record to propagate; the SSL certificate can only be issued once the domain points to your server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Project_Folder_and_env_File\"><\/span>3. Project Folder and .env File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir n8n-compose\ncd n8n-compose<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create a file named <code>.env<\/code> in the folder with your own values:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># n8n will be served at https:\/\/n8n.example.com\nDOMAIN_NAME=example.com\nSUBDOMAIN=n8n\n\n# Timezone used by Cron and other scheduling nodes\nGENERIC_TIMEZONE=Europe\/Istanbul\n\n# Email address for the TLS\/SSL certificate\nSSL_EMAIL=you@example.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you leave the timezone out, n8n uses New York time by default.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Shared_Files_Folder\"><\/span>4. Shared Files Folder<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create a <code>local-files<\/code> folder for sharing files between n8n and the host (for example with the Read\/Write Files from Disk node). Creating it manually makes sure it gets the right ownership and permissions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir local-files<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_The_composeyaml_File\"><\/span>5. The compose.yaml File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create <code>compose.yaml<\/code> in the same folder. It defines two containers: n8n itself and <strong>Traefik<\/strong>, a reverse proxy that obtains the SSL certificate and routes traffic to n8n:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  traefik:\n    image: \"traefik\"\n    restart: always\n    command:\n      - \"--api.insecure=true\"\n      - \"--providers.docker=true\"\n      - \"--providers.docker.exposedbydefault=false\"\n      - \"--entrypoints.web.address=:80\"\n      - \"--entrypoints.web.http.redirections.entryPoint.to=websecure\"\n      - \"--entrypoints.web.http.redirections.entrypoint.scheme=https\"\n      - \"--entrypoints.websecure.address=:443\"\n      - \"--certificatesresolvers.mytlschallenge.acme.tlschallenge=true\"\n      - \"--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}\"\n      - \"--certificatesresolvers.mytlschallenge.acme.storage=\/letsencrypt\/acme.json\"\n    ports:\n      - \"80:80\"\n      - \"443:443\"\n    volumes:\n      - traefik_data:\/letsencrypt\n      - \/var\/run\/docker.sock:\/var\/run\/docker.sock:ro\n\n  n8n:\n    image: n8nio\/n8n\n    restart: always\n    ports:\n      - \"127.0.0.1:5678:5678\"\n    labels:\n      - traefik.enable=true\n      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)\n      - traefik.http.routers.n8n.tls=true\n      - traefik.http.routers.n8n.entrypoints=web,websecure\n      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge\n      - traefik.http.middlewares.n8n.headers.SSLRedirect=true\n      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000\n      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true\n      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true\n      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true\n      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}\n      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true\n      - traefik.http.middlewares.n8n.headers.STSPreload=true\n      - traefik.http.routers.n8n.middlewares=n8n@docker\n    environment:\n      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true\n      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}\n      - N8N_PORT=5678\n      - N8N_PROTOCOL=https\n      - NODE_ENV=production\n      - N8N_WEBHOOK_URL=https:\/\/${SUBDOMAIN}.${DOMAIN_NAME}\/\n      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}\n      - TZ=${GENERIC_TIMEZONE}\n      - N8N_RESTRICT_FILE_ACCESS_TO=\/files\n    volumes:\n      - n8n_data:\/home\/node\/.n8n\n      - .\/local-files:\/files\n\nvolumes:\n  n8n_data:\n  traefik_data:<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>127.0.0.1:5678:<\/strong> n8n&#8217;s port is reachable only from inside the server; outside traffic arrives through Traefik over HTTPS.<\/li>\n<li><strong>N8N_WEBHOOK_URL:<\/strong> makes webhook URLs use https and your domain. It exists from n8n 2.30.0; earlier versions use <code>WEBHOOK_URL<\/code>.<\/li>\n<li><strong>n8n_data:<\/strong> holds the SQLite database and the <strong>encryption key<\/strong> that protects your credentials. Deleting this volume loses your data.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6_Open_the_Firewall\"><\/span>6. Open the Firewall<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 80\/tcp\nsudo ufw allow 443\/tcp<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Keep your SSH port open, and open these ports in your provider&#8217;s network firewall too if it has one. Port 5678 does not need to be public.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"7_Start_n8n\"><\/span>7. Start n8n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo docker compose up -d<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Open <code>https:\/\/n8n.example.com<\/code> and create the owner account on first launch. The instance is reachable over HTTPS only. To stop it, run <code>sudo docker compose stop<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Update_n8n\"><\/span>How to Update n8n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose pull\ndocker compose down\ndocker compose up -d<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">n8n releases a new minor version most weeks. Use the <code>stable<\/code> version in production; <code>beta<\/code> is the newest release and may be unstable. Back up before updating.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Backups_and_Database\"><\/span>Backups and Database<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Volume backup:<\/strong> <code>n8n_data<\/code> contains both the database and the encryption key; you need both to move or restore an instance.<\/li>\n<li><strong>Export workflows:<\/strong> you can download workflows as JSON from the n8n editor.<\/li>\n<li><strong>PostgreSQL:<\/strong> the default database is SQLite. Compose examples with PostgreSQL are in n8n&#8217;s official <a href=\"https:\/\/github.com\/n8n-io\/n8n-hosting\" target=\"_blank\" rel=\"noopener\">n8n-hosting<\/a> repository. Keep mounting <code>\/home\/node\/.n8n<\/code> even with PostgreSQL, because the encryption key lives there.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Troubleshooting\"><\/span>Troubleshooting<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Can&#8217;t connect:<\/strong> check that the A record points to the server IP and that ports 80\/443 are open.<\/li>\n<li><strong>Certificate error:<\/strong> if you started before DNS propagated, check <code>docker compose logs traefik<\/code>.<\/li>\n<li><strong>Webhook URLs show localhost:<\/strong> check the domain in <code>.env<\/code> and the <code>N8N_WEBHOOK_URL<\/code> line.<\/li>\n<li><strong>n8n logs:<\/strong> <code>docker compose logs -f n8n<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Prefer not to do this yourself? <a href=\"https:\/\/sunucun.com.tr\/\" data-internallinksmanager029f6b8e52c=\"75\" title=\"Sunucun veri merkezi ve altyap\u0131 \u00e7\u00f6z\u00fcmleri\">Sunucun<\/a>&#8217;s <a href=\"https:\/\/sunucun.com.tr\/en\/n8n-server\">n8n server<\/a> plans are delivered with n8n installed and ready to use, with full server access. To follow the steps above yourself, you can use a <a href=\"https:\/\/sunucun.com.tr\/en\/vds-server\">VDS server<\/a> with root access.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Frequently_Asked_Questions\"><\/span>Frequently Asked Questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Is_self-hosting_n8n_free\"><\/span>Is self-hosting n8n free?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">n8n is distributed under the Sustainable Use License (fair-code); self-hosting it for your own internal business processes is free. You pay for the server and domain.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Can_I_use_the_n8n_tunnel_on_a_server\"><\/span>Can I use the n8n tunnel on a server?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. According to n8n, the tunnel is for local development and testing only and is not safe for production. Use a domain with HTTPS as above.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>n8n is a workflow automation tool that connects apps and services, and you can host it on your own server. This guide shows how to install n8n on a Linux server (for example an Ubuntu VDS) with Docker Compose, serve it over HTTPS on your own domain, update it and back it up. The commands&hellip;<\/p>\n","protected":false},"author":1,"featured_media":21862,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1521],"tags":[],"class_list":["post-21861","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-teknoloji"],"_links":{"self":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts\/21861","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/comments?post=21861"}],"version-history":[{"count":0,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/posts\/21861\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/media\/21862"}],"wp:attachment":[{"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/media?parent=21861"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/categories?post=21861"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sunucun.com.tr\/blog\/wp-json\/wp\/v2\/tags?post=21861"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}