{"id":104896,"date":"2025-04-24T10:48:00","date_gmt":"2025-04-24T03:48:00","guid":{"rendered":"https:\/\/wiki.tino.org\/?p=104896"},"modified":"2026-10-23T10:47:32","modified_gmt":"2026-10-23T03:47:32","slug":"cach-cai-dat-n8n-tren-vps","status":"publish","type":"post","link":"https:\/\/tino.vn\/blog\/cach-cai-dat-n8n-tren-vps\/","title":{"rendered":"C\u00e1ch c\u00e0i \u0111\u1eb7t n8n tr\u00ean VPS b\u1eb1ng Docker Compose (t\u1ef1 host)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>C\u00e1ch c\u00e0i n8n tr\u00ean VPS \u0111\u01b0\u1ee3c t\u00e0i li\u1ec7u n8n h\u01b0\u1edbng d\u1eabn l\u00e0 ch\u1ea1y b\u1eb1ng Docker Compose:<\/strong> c\u00e0i Docker Engine v\u00e0 Compose v2, tr\u1ecf m\u1ed9t t\u00ean mi\u1ec1n ph\u1ee5 v\u1ec1 IP VPS, t\u1ea1o file <code>.env<\/code> v\u00e0 <code>compose.yaml<\/code>, r\u1ed3i \u0111\u1ec3 reverse proxy c\u1ea5p HTTPS. B\u1ea1n c\u1ea7n VPS Ubuntu 24.04 LTS, quy\u1ec1n sudo v\u00e0 kho\u1ea3ng 30 ph\u00fat.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">H\u01b0\u1edbng d\u1eabn d\u01b0\u1edbi \u0111\u00e2y vi\u1ebft cho n8n 2.x, b\u1ea3n stable 2.44.5 ng\u00e0y 21\/10\/2026 (<a href=\"https:\/\/github.com\/n8n-io\/n8n\/releases\" rel=\"nofollow noopener\" target=\"_blank\">GitHub n8n-io\/n8n<\/a>). N\u1ebfu b\u1ea1n m\u1edbi l\u00e0m quen, \u0111\u1ecdc tr\u01b0\u1edbc <a href=\"https:\/\/tino.vn\/blog\/n8n-la-gi\/\">n8n l\u00e0 g\u00ec<\/a>. N\u1ebfu VPS l\u00e0 kh\u00e1i ni\u1ec7m m\u1edbi, xem <a href=\"https:\/\/tino.vn\/blog\/vps-la-gi\/\">VPS l\u00e0 g\u00ec<\/a>.<\/p>\n\n\n\n<h2 id=\"C\u1ea7n_chu\u1ea9n_b\u1ecb_g\u00ec_tr\u01b0\u1edbc_khi_c\u00e0i_n8n_tr\u00ean_VPS?\">C\u1ea7n chu\u1ea9n b\u1ecb g\u00ec tr\u01b0\u1edbc khi c\u00e0i n8n tr\u00ean VPS?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u1ec3 c\u00e0i n8n tr\u00ean VPS, b\u1ea1n c\u1ea7n b\u1ed1n th\u1ee9: m\u1ed9t VPS ch\u1ea1y Ubuntu LTS c\u00f2n \u0111\u01b0\u1ee3c h\u1ed7 tr\u1ee3, quy\u1ec1n sudo qua SSH, m\u1ed9t t\u00ean mi\u1ec1n ph\u1ee5 nh\u01b0 n8n.example.com tr\u1ecf v\u1ec1 IP VPS v\u00e0 Docker Engine k\u00e8m Compose v2. n8n kh\u00f4ng c\u00f4ng b\u1ed1 m\u1ed9t m\u1ee9c RAM c\u1ed1 \u0111\u1ecbnh, v\u00ec b\u1ed9 nh\u1edb t\u0103ng theo d\u1eef li\u1ec7u m\u1ed7i l\u1ea7n ch\u1ea1y.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Th\u00e0nh ph\u1ea7n<\/th><th>G\u1ee3i \u00fd<\/th><th>Ghi ch\u00fa<\/th><\/tr><\/thead><tbody><tr><td>VPS<\/td><td>2 vCPU, 4 GB RAM cho c\u00e1 nh\u00e2n ho\u1eb7c nh\u00f3m nh\u1ecf<\/td><td>M\u1ee9c tham kh\u1ea3o, kh\u00f4ng ph\u1ea3i y\u00eau c\u1ea7u c\u1ee7a n8n. C\u00e1ch \u01b0\u1edbc l\u01b0\u1ee3ng: <a href=\"https:\/\/tino.vn\/blog\/cau-hinh-toi-thieu-de-trien-khai-vps-n8n\/\">c\u1ea5u h\u00ecnh t\u1ed1i thi\u1ec3u \u0111\u1ec3 ch\u1ea1y n8n<\/a><\/td><\/tr><tr><td>H\u1ec7 \u0111i\u1ec1u h\u00e0nh<\/td><td>Ubuntu 24.04 LTS<\/td><td>Docker h\u1ed7 tr\u1ee3 Ubuntu 22.04, 24.04 v\u00e0 26.04 LTS (<a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\" rel=\"nofollow noopener\" target=\"_blank\">Docker Docs<\/a>)<\/td><\/tr><tr><td>T\u00ean mi\u1ec1n<\/td><td>B\u1ea3n ghi A: n8n \u2192 IP VPS<\/td><td>C\u1ea7n c\u00f3 tr\u01b0\u1edbc khi xin ch\u1ee9ng ch\u1ec9 SSL<\/td><\/tr><tr><td>Truy c\u1eadp<\/td><td>SSH b\u1eb1ng t\u00e0i kho\u1ea3n c\u00f3 sudo<\/td><td>Ch\u01b0a quen SSH: <a href=\"https:\/\/tino.vn\/blog\/cach-ket-noi-vps\/\">c\u00e1ch k\u1ebft n\u1ed1i VPS<\/a><\/td><\/tr><tr><td>Ph\u1ea7n m\u1ec1m<\/td><td>Docker Engine, plugin Compose v2, Caddy ho\u1eb7c Nginx<\/td><td>C\u00e0i \u1edf c\u00e1c b\u01b0\u1edbc b\u00ean d\u01b0\u1edbi<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Chu\u1ea9n b\u1ecb tr\u01b0\u1edbc khi c\u00e0i n8n tr\u00ean VPS<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/word-image-104896-4.png\" alt=\"C\u1ea5u h\u00ecnh t\u1ed1i thi\u1ec3u \u0111\u1ec3 ch\u1ea1y n8n tr\u00ean VPS\" class=\"wp-image-104900\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/word-image-104896-4.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/word-image-104896-4-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Shared hosting kh\u00f4ng \u0111\u1ee7 \u0111i\u1ec1u ki\u1ec7n: n8n c\u1ea7n ch\u1ea1y ti\u1ebfn tr\u00ecnh n\u1ec1n li\u00ean t\u1ee5c v\u00e0 c\u1ea7n Docker ho\u1eb7c Node.js. Chi ti\u1ebft \u1edf b\u00e0i <a href=\"https:\/\/tino.vn\/blog\/n8n-co-chay-duoc-tren-hosting-khong\/\">n8n c\u00f3 ch\u1ea1y \u0111\u01b0\u1ee3c tr\u00ean hosting kh\u00f4ng<\/a>.<\/p>\n\n\n\n<h2 id=\"N\u00ean_c\u00e0i_n8n_b\u1eb1ng_Docker_Compose,_npm,_VPS_c\u00e0i_s\u1eb5n_hay_n8n_Cloud?\">N\u00ean c\u00e0i n8n b\u1eb1ng Docker Compose, npm, VPS c\u00e0i s\u1eb5n hay n8n Cloud?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Docker Compose l\u00e0 c\u00e1ch n8n khuy\u1ebfn ngh\u1ecb \u0111\u1ec3 t\u1ef1 host: n8n v\u00e0 c\u00e1c th\u00e0nh ph\u1ea7n \u0111i k\u00e8m n\u1eb1m trong container, c\u1eadp nh\u1eadt b\u1eb1ng c\u00e1ch \u0111\u1ed5i tag image. C\u00e0i b\u1eb1ng npm v\u1eabn ch\u1ea1y \u1edf n8n 2.x, nh\u01b0ng n8n 3.0 s\u1eafp ph\u00e1t h\u00e0nh kh\u00f4ng c\u00f2n h\u1ed7 tr\u1ee3 c\u00e1ch n\u00e0y (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/install-options\/install-with-npm\" rel=\"nofollow noopener\" target=\"_blank\">docs.n8n.io<\/a>). Hai c\u00e1ch c\u00f2n l\u1ea1i d\u00e0nh cho ng\u01b0\u1eddi kh\u00f4ng mu\u1ed1n qu\u1ea3n tr\u1ecb m\u00e1y ch\u1ee7.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>C\u00e1ch ch\u1ea1y<\/th><th>H\u1ee3p v\u1edbi ai<\/th><th>B\u1ea1n t\u1ef1 lo<\/th><th>\u0110\u1ecdc th\u00eam<\/th><\/tr><\/thead><tbody><tr><td>Docker Compose tr\u00ean VPS<\/td><td>Ng\u01b0\u1eddi qu\u1ea3n tr\u1ecb \u0111\u01b0\u1ee3c Linux, c\u1ea7n ch\u1ea1y 24\/7<\/td><td>C\u00e0i \u0111\u1eb7t, SSL, c\u1eadp nh\u1eadt, sao l\u01b0u<\/td><td>B\u00e0i n\u00e0y<\/td><\/tr><tr><td>npm + pm2 tr\u00ean VPS<\/td><td>\u0110\u00e3 c\u00f3 h\u1ec7 th\u1ed1ng ch\u1ea1y npm, ch\u01b0a chuy\u1ec3n k\u1ecbp<\/td><td>Nh\u01b0 tr\u00ean, th\u00eam Node.js 20.19\u201324.x<\/td><td><a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/install-options\/install-with-npm\" rel=\"nofollow noopener\" target=\"_blank\">Install with npm<\/a><\/td><\/tr><tr><td>VPS c\u00e0i s\u1eb5n n8n<\/td><td>Mu\u1ed1n m\u00e1y ch\u1ee7 ri\u00eang nh\u01b0ng kh\u00f4ng t\u1ef1 c\u00e0i<\/td><td>Workflow, theo d\u00f5i phi\u00ean b\u1ea3n<\/td><td><a href=\"https:\/\/tino.vn\/blog\/vps-n8n\/\">VPS n8n l\u00e0 g\u00ec<\/a><\/td><\/tr><tr><td>n8n Cloud<\/td><td>Kh\u00f4ng mu\u1ed1n qu\u1ea3n tr\u1ecb m\u00e1y ch\u1ee7<\/td><td>Workflow; tr\u1ea3 ph\u00ed theo l\u01b0\u1ee3t ch\u1ea1y<\/td><td><a href=\"https:\/\/tino.vn\/blog\/so-sanh-n8n-self-host-va-n8n-cloud\/\">so s\u00e1nh n8n self-host v\u00e0 n8n Cloud<\/a><\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">B\u1ed1n c\u00e1ch ch\u1ea1y n8n, c\u1eadp nh\u1eadt 22\/10\/2026<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1400\" height=\"750\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-chon-cach.webp\" alt=\"S\u01a1 \u0111\u1ed3 ch\u1ecdn n\u01a1i ch\u1ea1y n8n: n\u1ebfu workflow kh\u00f4ng c\u1ea7n ch\u1ea1y 24\/7 hay nh\u1eadn webhook t\u1eeb Internet th\u00ec ch\u1ea1y tr\u00ean m\u00e1y t\u00ednh b\u1eb1ng Docker Desktop; n\u1ebfu c\u1ea7n v\u00e0 b\u1ea1n t\u1ef1 qu\u1ea3n tr\u1ecb \u0111\u01b0\u1ee3c m\u00e1y ch\u1ee7 Linux th\u00ec t\u1ef1 c\u00e0i n8n tr\u00ean VPS b\u1eb1ng Docker Compose; n\u1ebfu kh\u00f4ng t\u1ef1 qu\u1ea3n tr\u1ecb nh\u01b0ng d\u1eef li\u1ec7u ph\u1ea3i n\u1eb1m tr\u00ean m\u00e1y ch\u1ee7 ri\u00eang th\u00ec d\u00f9ng VPS c\u00e0i s\u1eb5n n8n; c\u00f2n l\u1ea1i d\u00f9ng n8n Cloud tr\u1ea3 ph\u00ed theo l\u01b0\u1ee3t ch\u1ea1y\" class=\"wp-image-131438\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-chon-cach.webp 1400w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-chon-cach-300x161.webp 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-chon-cach-1024x549.webp 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-chon-cach-768x411.webp 768w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Ch\u1ec9 c\u1ea7n th\u1eed n8n tr\u00ean laptop th\u00ec xem <a href=\"https:\/\/tino.vn\/blog\/cach-cai-dat-n8n-tren-may-tinh-pc\/\">c\u00e1ch c\u00e0i n8n tr\u00ean m\u00e1y t\u00ednh PC b\u1eb1ng Docker Desktop<\/a>. Ph\u00e2n v\u00e2n c\u00f3 n\u00ean t\u1ef1 host kh\u00f4ng th\u00ec \u0111\u1ecdc <a href=\"https:\/\/tino.vn\/blog\/uu-nhuoc-diem-cua-self-hosted-n8n\/\">\u01b0u nh\u01b0\u1ee3c \u0111i\u1ec3m c\u1ee7a n8n self-host<\/a> v\u00e0 <a href=\"https:\/\/tino.vn\/blog\/chi-phi-tu-host-n8n-tren-vps-la-bao-nhieu\/\">chi ph\u00ed t\u1ef1 host n8n tr\u00ean VPS<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/cach-cai-dat-n8n-tren-vps-1.png\" alt=\"\u01afu \u0111i\u1ec3m c\u1ee7a vi\u1ec7c t\u1ef1 host n8n so v\u1edbi d\u00f9ng n8n Cloud\" class=\"wp-image-104917\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/cach-cai-dat-n8n-tren-vps-1.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/cach-cai-dat-n8n-tren-vps-1-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<h3 id=\"V\u00ec_sao_n\u00ean_ch\u1ea1y_n8n_tr\u00ean_VPS_thay_v\u00ec_m\u00e1y_t\u00ednh_c\u00e1_nh\u00e2n?\">V\u00ec sao n\u00ean ch\u1ea1y n8n tr\u00ean VPS thay v\u00ec m\u00e1y t\u00ednh c\u00e1 nh\u00e2n?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">VPS ch\u1ea1y li\u00ean t\u1ee5c v\u00e0 c\u00f3 IP c\u00f4ng khai, n\u00ean workflow theo l\u1ecbch kh\u00f4ng d\u1eebng khi b\u1ea1n t\u1eaft m\u00e1y, c\u00f2n webhook t\u1eeb Telegram hay form web g\u1ecdi v\u00e0o \u0111\u01b0\u1ee3c. B\u1ea1n c\u00f3 quy\u1ec1n root \u0111\u1ec3 c\u00e0i Docker, ch\u1ecdn database, \u0111\u1eb7t t\u01b0\u1eddng l\u1eeda v\u00e0 t\u1ef1 sao l\u01b0u. Khi workflow nhi\u1ec1u l\u00ean, b\u1ea1n n\u00e2ng RAM, CPU m\u00e0 kh\u00f4ng ph\u1ea3i c\u00e0i l\u1ea1i.<\/p>\n\n\n\n<h2 id=\"C\u00e1c_b\u01b0\u1edbc_c\u00e0i_n8n_tr\u00ean_VPS_b\u1eb1ng_Docker_Compose\">C\u00e1c b\u01b0\u1edbc c\u00e0i n8n tr\u00ean VPS b\u1eb1ng Docker Compose<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Quy tr\u00ecnh g\u1ed3m 8 b\u01b0\u1edbc, theo trang Use Docker Compose c\u1ee7a n8n (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/install-options\/use-a-cloud-provider\/use-docker-compose\" rel=\"nofollow noopener\" target=\"_blank\">docs.n8n.io<\/a>): tr\u1ecf t\u00ean mi\u1ec1n, c\u00e0i Docker, m\u1edf t\u01b0\u1eddng l\u1eeda, t\u1ea1o file c\u1ea5u h\u00ecnh, kh\u1edfi \u0111\u1ed9ng n8n, c\u00e0i reverse proxy l\u1ea5y HTTPS, r\u1ed3i t\u1ea1o t\u00e0i kho\u1ea3n owner. V\u00ed d\u1ee5 d\u00f9ng t\u00ean mi\u1ec1n n8n.example.com; thay b\u1eb1ng t\u00ean mi\u1ec1n c\u1ee7a b\u1ea1n.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1400\" height=\"750\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-kien-truc.webp\" alt=\"Ki\u1ebfn tr\u00fac n8n t\u1ef1 host tr\u00ean VPS Ubuntu 24.04: tr\u00ecnh duy\u1ec7t v\u00e0 webhook g\u1ecdi https:\/\/n8n.example.com, t\u01b0\u1eddng l\u1eeda UFW ch\u1ec9 m\u1edf c\u1ed5ng 22, 80, 443, Caddy ho\u1eb7c Nginx c\u1ea5p SSL v\u00e0 g\u1eedi header X-Forwarded v\u00e0o container n8n nghe \u1edf 127.0.0.1:5678 v\u1edbi N8N_WEBHOOK_URL v\u00e0 N8N_PROXY_HOPS=1; d\u1eef li\u1ec7u n\u1eb1m \u1edf th\u01b0 m\u1ee5c ~\/n8n-compose (compose.yaml, .env), volume n8n_data (kh\u00f3a m\u00e3 h\u00f3a, SQLite) v\u00e0 PostgreSQL t\u00f9y ch\u1ecdn\" class=\"wp-image-131439\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-kien-truc.webp 1400w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-kien-truc-300x161.webp 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-kien-truc-1024x549.webp 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-kien-truc-768x411.webp 768w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/figure>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_1:_Tr\u1ecf_t\u00ean_mi\u1ec1n_ph\u1ee5_v\u1ec1_IP_VPS\">B\u01b0\u1edbc 1: Tr\u1ecf t\u00ean mi\u1ec1n ph\u1ee5 v\u1ec1 IP VPS<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">T\u1ea1i n\u01a1i qu\u1ea3n l\u00fd DNS, t\u1ea1o b\u1ea3n ghi A t\u00ean <code>n8n<\/code> tr\u1ecf v\u1ec1 IP VPS. Ki\u1ec3m tra b\u1eb1ng l\u1ec7nh d\u01b0\u1edbi \u0111\u00e2y; k\u1ebft qu\u1ea3 ph\u1ea3i l\u00e0 IP VPS c\u1ee7a b\u1ea1n. DNS c\u00f3 th\u1ec3 m\u1ea5t v\u00e0i ph\u00fat \u0111\u1ebfn v\u00e0i gi\u1edd \u0111\u1ec3 c\u1eadp nh\u1eadt.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dig +short n8n.example.com<\/code><\/pre>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_2:_C\u00e0i_Docker_Engine_v\u00e0_Docker_Compose_v2\">B\u01b0\u1edbc 2: C\u00e0i Docker Engine v\u00e0 Docker Compose v2<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">C\u00e0i Docker t\u1eeb kho ch\u00ednh th\u1ee9c c\u1ee7a Docker, kh\u00f4ng d\u00f9ng g\u00f3i <code>docker.io<\/code> c\u0169 c\u1ee7a Ubuntu. C\u00e1c l\u1ec7nh d\u01b0\u1edbi \u0111\u00e2y ch\u00e9p t\u1eeb <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\" rel=\"nofollow noopener\" target=\"_blank\">h\u01b0\u1edbng d\u1eabn c\u00e0i Docker tr\u00ean Ubuntu<\/a> (truy c\u1eadp 22\/10\/2026). Compose v2 l\u00e0 plugin, g\u1ecdi b\u1eb1ng <code>docker compose<\/code> (c\u00f3 d\u1ea5u c\u00e1ch).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Th\u00eam kh\u00f3a GPG v\u00e0 kho apt c\u1ee7a Docker\nsudo apt update\nsudo apt install -y ca-certificates curl\nsudo install -m 0755 -d \/etc\/apt\/keyrings\nsudo curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg -o \/etc\/apt\/keyrings\/docker.asc\nsudo chmod a+r \/etc\/apt\/keyrings\/docker.asc\nsudo tee \/etc\/apt\/sources.list.d\/docker.sources &lt;&lt;EOF\nTypes: deb\nURIs: https:\/\/download.docker.com\/linux\/ubuntu\nSuites: $(. \/etc\/os-release &amp;&amp; echo \"${UBUNTU_CODENAME:-$VERSION_CODENAME}\")\nComponents: stable\nArchitectures: $(dpkg --print-architecture)\nSigned-By: \/etc\/apt\/keyrings\/docker.asc\nEOF\nsudo apt update\n\n# C\u00e0i Docker Engine v\u00e0 plugin Compose v2\nsudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\n\n# Ki\u1ec3m tra\ndocker --version\ndocker compose version<\/code><\/pre>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_3:_M\u1edf_t\u01b0\u1eddng_l\u1eeda_cho_SSH,_HTTP_v\u00e0_HTTPS\">B\u01b0\u1edbc 3: M\u1edf t\u01b0\u1eddng l\u1eeda cho SSH, HTTP v\u00e0 HTTPS<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">M\u1edf c\u1ed5ng SSH tr\u01b0\u1edbc r\u1ed3i m\u1edbi b\u1eadt UFW, n\u1ebfu kh\u00f4ng b\u1ea1n c\u00f3 th\u1ec3 t\u1ef1 kh\u00f3a m\u00ecnh ngo\u00e0i VPS. Kh\u00f4ng m\u1edf c\u1ed5ng 5678: n8n ch\u1ec9 nh\u1eadn k\u1ebft n\u1ed1i qua reverse proxy.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow OpenSSH\nsudo ufw allow 80\/tcp\nsudo ufw allow 443\/tcp\nsudo ufw enable\nsudo ufw status<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">L\u01b0u \u00fd: c\u1ed5ng Docker publish ra m\u1ecdi \u0111\u1ecba ch\u1ec9 (v\u00ed d\u1ee5 <code>\"5678:5678\"<\/code>) v\u1eabn truy c\u1eadp \u0111\u01b0\u1ee3c t\u1eeb Internet d\u00f9 UFW ch\u1eb7n, v\u00ec Docker t\u1ef1 th\u00eam lu\u1eadt t\u01b0\u1eddng l\u1eeda tr\u01b0\u1edbc UFW (<a href=\"https:\/\/docs.docker.com\/engine\/network\/packet-filtering-firewalls\/\" rel=\"nofollow noopener\" target=\"_blank\">Docker Docs, Docker and ufw<\/a>). V\u00ec v\u1eady file compose \u1edf b\u01b0\u1edbc 5 g\u1eafn c\u1ed5ng v\u00e0o <code>127.0.0.1<\/code>.<\/p>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_4:_T\u1ea1o_th\u01b0_m\u1ee5c_d\u1ef1_\u00e1n_v\u00e0_file_.env\">B\u01b0\u1edbc 4: T\u1ea1o th\u01b0 m\u1ee5c d\u1ef1 \u00e1n v\u00e0 file .env<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">File <code>.env<\/code> gi\u1eef t\u00ean mi\u1ec1n, m\u00fai gi\u1edd v\u00e0 kh\u00f3a m\u00e3 h\u00f3a. n8n d\u00f9ng kh\u00f3a n\u00e0y \u0111\u1ec3 m\u00e3 h\u00f3a credentials trong database (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/basic-configuration\/configuration-examples\/set-a-custom-encryption-key\" rel=\"nofollow noopener\" target=\"_blank\">Set a custom encryption key<\/a>). T\u1ef1 \u0111\u1eb7t kh\u00f3a gi\u00fap b\u1ea1n kh\u00f4i ph\u1ee5c \u0111\u01b0\u1ee3c credentials khi chuy\u1ec3n m\u00e1y ch\u1ee7; ch\u00e9p kh\u00f3a ra n\u01a1i an to\u00e0n ngo\u00e0i VPS.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p ~\/n8n-compose\/local-files\ncd ~\/n8n-compose\nsudo chown 1000:1000 local-files\n\ncat &gt; .env &lt;&lt;'EOF'\nN8N_DOMAIN=n8n.example.com\nGENERIC_TIMEZONE=Asia\/Ho_Chi_Minh\nEOF\necho \"N8N_ENCRYPTION_KEY=$(openssl rand -hex 32)\" &gt;&gt; .env\nchmod 600 .env\ncat .env<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Th\u01b0 m\u1ee5c <code>local-files<\/code> l\u00e0 n\u01a1i node Read\/Write Files \u0111\u01b0\u1ee3c ph\u00e9p \u0111\u1ecdc ghi. T\u1eeb n8n 2.0, c\u00e1c node n\u00e0y ch\u1ec9 truy c\u1eadp th\u01b0 m\u1ee5c \u0111\u01b0\u1ee3c cho ph\u00e9p, n\u00ean file compose \u0111\u1eb7t <code>N8N_RESTRICT_FILE_ACCESS_TO=\/files<\/code>. L\u1ec7nh <code>chown 1000:1000<\/code> trao quy\u1ec1n cho user <code>node<\/code> trong container.<\/p>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_5:_T\u1ea1o_file_compose.yaml\">B\u01b0\u1edbc 5: T\u1ea1o file compose.yaml<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">File d\u01b0\u1edbi \u0111\u00e2y r\u00fat t\u1eeb m\u1eabu c\u1ee7a n8n, b\u1ecf Traefik v\u00ec d\u00f9ng Caddy ho\u1eb7c Nginx \u1edf b\u01b0\u1edbc 7. Kh\u00f4ng c\u00f3 d\u00f2ng <code>version:<\/code> v\u00ec Compose v2 kh\u00f4ng c\u1ea7n. Ghim phi\u00ean b\u1ea3n c\u1ee5 th\u1ec3 thay v\u00ec <code>latest<\/code>; t\u1eeb n8n 2.0, n8n khuy\u00ean ghim phi\u00ean b\u1ea3n (<a href=\"https:\/\/docs.n8n.io\/changelog\/v20-breaking-changes\" rel=\"nofollow noopener\" target=\"_blank\">v2.0 breaking changes<\/a>).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  n8n:\n    image: n8nio\/n8n:2.44.5\n    restart: unless-stopped\n    ports:\n      - \"127.0.0.1:5678:5678\"\n    environment:\n      - N8N_HOST=${N8N_DOMAIN}\n      - N8N_PORT=5678\n      - N8N_PROTOCOL=https\n      - N8N_WEBHOOK_URL=https:\/\/${N8N_DOMAIN}\/\n      - N8N_PROXY_HOPS=1\n      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}\n      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true\n      - N8N_RESTRICT_FILE_ACCESS_TO=\/files\n      - NODE_ENV=production\n      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}\n      - TZ=${GENERIC_TIMEZONE}\n    volumes:\n      - n8n_data:\/home\/node\/.n8n\n      - .\/local-files:\/files\n\nvolumes:\n  n8n_data:<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Bi\u1ebfn<\/th><th>T\u00e1c d\u1ee5ng<\/th><\/tr><\/thead><tbody><tr><td><code>N8N_WEBHOOK_URL<\/code><\/td><td>URL g\u1ed1c c\u1ee7a webhook khi ch\u1ea1y sau reverse proxy. C\u00f3 t\u1eeb n8n 2.30.0; bi\u1ebfn c\u0169 <code>WEBHOOK_URL<\/code> b\u1ecb deprecated t\u1eeb 2.35.0, v\u1eabn ch\u1ea1y nh\u01b0ng n8n ghi c\u1ea3nh b\u00e1o (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/basic-configuration\/use-environment-variables\/endpoints\" rel=\"nofollow noopener\" target=\"_blank\">Endpoints<\/a>)<\/td><\/tr><tr><td><code>N8N_PROXY_HOPS=1<\/code><\/td><td>B\u00e1o n8n c\u00f3 m\u1ed9t proxy \u0111\u1ee9ng tr\u01b0\u1edbc, \u0111\u1ec3 \u0111\u1ecdc \u0111\u00fang IP v\u00e0 giao th\u1ee9c t\u1eeb header X-Forwarded (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/basic-configuration\/configuration-examples\/configure-webhook-urls-with-reverse-proxy\" rel=\"nofollow noopener\" target=\"_blank\">Configure webhook URLs with reverse proxy<\/a>)<\/td><\/tr><tr><td><code>N8N_ENCRYPTION_KEY<\/code><\/td><td>Kh\u00f3a m\u00e3 h\u00f3a credentials. \u0110\u1eb7t m\u1ed9t l\u1ea7n, kh\u00f4ng \u0111\u1ed5i v\u1ec1 sau<\/td><\/tr><tr><td><code>127.0.0.1:5678:5678<\/code><\/td><td>Ch\u1ec9 reverse proxy tr\u00ean ch\u00ednh VPS g\u1ecdi \u0111\u01b0\u1ee3c n8n<\/td><\/tr><tr><td><code>GENERIC_TIMEZONE<\/code>, <code>TZ<\/code><\/td><td>M\u00fai gi\u1edd cho Schedule Trigger v\u00e0 cho l\u1ec7nh trong container<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">C\u00e1c bi\u1ebfn ch\u00ednh trong compose.yaml<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">B\u1ea3n c\u0169 c\u1ee7a b\u00e0i n\u00e0y d\u00f9ng nh\u00f3m bi\u1ebfn Basic Auth \u0111\u1ec3 \u0111\u1eb7t m\u1eadt kh\u1ea9u. Nh\u00f3m bi\u1ebfn \u0111\u00f3 \u0111\u00e3 b\u1ecb g\u1ee1 t\u1eeb n8n 1.0; nay n8n b\u1eaft bu\u1ed9c t\u1ea1o t\u00e0i kho\u1ea3n owner \u1edf l\u1ea7n m\u1edf \u0111\u1ea7u ti\u00ean.<\/p>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_6:_Kh\u1edfi_\u0111\u1ed9ng_n8n_v\u00e0_ki\u1ec3m_tra\">B\u01b0\u1edbc 6: Kh\u1edfi \u0111\u1ed9ng n8n v\u00e0 ki\u1ec3m tra<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ch\u1ea1y l\u1ec7nh <code>docker compose config<\/code> tr\u01b0\u1edbc \u0111\u1ec3 Compose b\u00e1o l\u1ed7i c\u00fa ph\u00e1p n\u1ebfu c\u00f3, r\u1ed3i kh\u1edfi \u0111\u1ed9ng. Khi log hi\u1ec7n d\u00f2ng &#8220;Editor is now accessible via&#8221;, n8n \u0111\u00e3 ch\u1ea1y.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/n8n-compose\ndocker compose config --quiet &amp;&amp; echo \"compose.yaml h\u1ee3p l\u1ec7\"\ndocker compose up -d\ndocker compose ps\ndocker compose logs -f n8n      # Ctrl + C \u0111\u1ec3 tho\u00e1t\ncurl -I http:\/\/127.0.0.1:5678<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/cach-cai-dat-n8n-tren-vps-5.png\" alt=\"C\u00e1ch c\u00e0i \u0111\u1eb7t n8n tr\u00ean VPS th\u1ee7 c\u00f4ng b\u1eb1ng d\u00f2ng l\u1ec7nh\" class=\"wp-image-104920\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/cach-cai-dat-n8n-tren-vps-5.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/cach-cai-dat-n8n-tren-vps-5-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_7:_C\u00e0i_Caddy_\u0111\u1ec3_c\u00f3_HTTPS\">B\u01b0\u1edbc 7: C\u00e0i Caddy \u0111\u1ec3 c\u00f3 HTTPS<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Caddy t\u1ef1 xin v\u00e0 gia h\u1ea1n ch\u1ee9ng ch\u1ec9 Let&#8217;s Encrypt khi bi\u1ebft t\u00ean mi\u1ec1n, v\u00e0 t\u1ef1 g\u1eedi c\u00e1c header X-Forwarded-For, X-Forwarded-Host, X-Forwarded-Proto m\u00e0 n8n c\u1ea7n. L\u1ec7nh c\u00e0i theo <a href=\"https:\/\/caddyserver.com\/docs\/install\" rel=\"nofollow noopener\" target=\"_blank\">trang c\u00e0i \u0111\u1eb7t c\u1ee7a Caddy<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl\ncurl -1sLf 'https:\/\/dl.cloudsmith.io\/public\/caddy\/stable\/gpg.key' | sudo gpg --dearmor -o \/usr\/share\/keyrings\/caddy-stable-archive-keyring.gpg\ncurl -1sLf 'https:\/\/dl.cloudsmith.io\/public\/caddy\/stable\/debian.deb.txt' | sudo tee \/etc\/apt\/sources.list.d\/caddy-stable.list\nsudo chmod o+r \/usr\/share\/keyrings\/caddy-stable-archive-keyring.gpg\nsudo chmod o+r \/etc\/apt\/sources.list.d\/caddy-stable.list\nsudo apt update\nsudo apt install -y caddy<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Thay to\u00e0n b\u1ed9 n\u1ed9i dung <code>\/etc\/caddy\/Caddyfile<\/code> b\u1eb1ng hai d\u00f2ng sau, r\u1ed3i n\u1ea1p l\u1ea1i Caddy:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>n8n.example.com {\n    reverse_proxy 127.0.0.1:5678\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo caddy validate --config \/etc\/caddy\/Caddyfile\nsudo systemctl reload caddy<\/code><\/pre>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_8:_M\u1edf_n8n_v\u00e0_t\u1ea1o_t\u00e0i_kho\u1ea3n_owner\">B\u01b0\u1edbc 8: M\u1edf n8n v\u00e0 t\u1ea1o t\u00e0i kho\u1ea3n owner<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Truy c\u1eadp https:\/\/n8n.example.com, t\u1ea1o t\u00e0i kho\u1ea3n owner b\u1eb1ng email v\u00e0 m\u1eadt kh\u1ea9u m\u1ea1nh. Sau \u0111\u00f3 b\u1eadt x\u00e1c th\u1ef1c hai l\u1edbp cho t\u00e0i kho\u1ea3n n\u00e0y. Th\u00eam ng\u01b0\u1eddi d\u00f9ng v\u00e0 ph\u00e2n quy\u1ec1n xem <a href=\"https:\/\/tino.vn\/blog\/cach-them-xoa-va-phan-quyen-user-trong-n8n\/\">c\u00e1ch th\u00eam, x\u00f3a v\u00e0 ph\u00e2n quy\u1ec1n user trong n8n<\/a>. Workflow \u0111\u1ea7u ti\u00ean: <a href=\"https:\/\/tino.vn\/blog\/cach-tao-workflow-tren-n8n-co-ban\/\">c\u00e1ch t\u1ea1o workflow n8n c\u01a1 b\u1ea3n<\/a>.<\/p>\n\n\n\n<h2 id=\"D\u00f9ng_Nginx_v\u00e0_Certbot_thay_cho_Caddy_\u0111\u01b0\u1ee3c_kh\u00f4ng?\">D\u00f9ng Nginx v\u00e0 Certbot thay cho Caddy \u0111\u01b0\u1ee3c kh\u00f4ng?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Nginx v\u00e0 Certbot d\u00f9ng \u0111\u01b0\u1ee3c thay Caddy, ph\u00f9 h\u1ee3p khi VPS \u0111\u00e3 ch\u1ea1y Nginx cho website kh\u00e1c. Kh\u00e1c bi\u1ec7t l\u00e0 Nginx kh\u00f4ng t\u1ef1 g\u1eedi header X-Forwarded v\u00e0 kh\u00f4ng t\u1ef1 xin ch\u1ee9ng ch\u1ec9, n\u00ean b\u1ea1n ph\u1ea3i khai b\u00e1o \u0111\u1ee7 header r\u1ed3i ch\u1ea1y Certbot. C\u1ea5u h\u00ecnh chi ti\u1ebft c\u00f3 \u1edf b\u00e0i <a href=\"https:\/\/tino.vn\/blog\/cau-hinh-nginx-reverse-proxy-va-ssl-cho-n8n\/\">c\u1ea5u h\u00ecnh Nginx reverse proxy v\u00e0 SSL cho n8n<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    listen 80;\n    server_name n8n.example.com;\n    client_max_body_size 16m;\n\n    location \/ {\n        proxy_pass http:\/\/127.0.0.1:5678;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n        proxy_set_header Host $host;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Host $host;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_buffering off;\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">L\u01b0u file v\u00e0o <code>\/etc\/nginx\/sites-available\/n8n<\/code>, b\u1eadt site, ki\u1ec3m tra c\u00fa ph\u00e1p, r\u1ed3i xin ch\u1ee9ng ch\u1ec9 theo <a href=\"https:\/\/certbot.eff.org\/instructions?ws=nginx&#038;os=snap\" rel=\"nofollow noopener\" target=\"_blank\">h\u01b0\u1edbng d\u1eabn c\u1ee7a Certbot<\/a>. <code>client_max_body_size 16m<\/code> kh\u1edbp gi\u1edbi h\u1ea1n payload m\u1eb7c \u0111\u1ecbnh 16 MB c\u1ee7a n8n. Hai d\u00f2ng Upgrade, Connection gi\u1eef k\u1ebft n\u1ed1i WebSocket cho tr\u00ecnh so\u1ea1n workflow.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ln -s \/etc\/nginx\/sites-available\/n8n \/etc\/nginx\/sites-enabled\/\nsudo nginx -t &amp;&amp; sudo systemctl reload nginx\nsudo snap install --classic certbot\nsudo ln -s \/snap\/bin\/certbot \/usr\/local\/bin\/certbot\nsudo certbot --nginx -d n8n.example.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Tr\u00ean VPS ch\u01b0a c\u00f3 web server n\u00e0o, Caddy g\u1ecdn h\u01a1n. C\u00e1ch c\u1ea5p SSL n\u00f3i chung: <a href=\"https:\/\/tino.vn\/blog\/cai-ssl-tren-vps\/\">c\u00e0i SSL tr\u00ean VPS<\/a>.<\/p>\n\n\n\n<h2 id=\"Khi_n\u00e0o_n\u00ean_d\u00f9ng_PostgreSQL_thay_cho_SQLite?\">Khi n\u00e0o n\u00ean d\u00f9ng PostgreSQL thay cho SQLite?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">n8n m\u1eb7c \u0111\u1ecbnh l\u01b0u d\u1eef li\u1ec7u b\u1eb1ng SQLite trong volume n8n_data, \u0111\u1ee7 cho c\u00e1 nh\u00e2n v\u00e0 nh\u00f3m nh\u1ecf. N\u00ean ch\u1ecdn PostgreSQL khi l\u01b0\u1ee3t ch\u1ea1y nhi\u1ec1u, l\u1ecbch s\u1eed ch\u1ea1y l\u1edbn ho\u1eb7c \u0111\u1ecbnh b\u1eadt queue mode. n8n h\u1ed7 tr\u1ee3 PostgreSQL 16, 17 v\u00e0 18 t\u00ednh \u0111\u1ebfn 07\/2026; MySQL v\u00e0 MariaDB kh\u00f4ng c\u00f2n \u0111\u01b0\u1ee3c h\u1ed7 tr\u1ee3 l\u00e0m database t\u1eeb 2.0 (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/choose-n8ns-database\" rel=\"nofollow noopener\" target=\"_blank\">Choose n8n&#8217;s database<\/a>).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">N\u00ean ch\u1ecdn database ngay l\u00fac c\u00e0i. \u0110\u1ed5i v\u1ec1 sau kh\u00f4ng t\u1ef1 chuy\u1ec3n d\u1eef li\u1ec7u: b\u1ea1n ph\u1ea3i xu\u1ea5t b\u1eb1ng <code>n8n export:entities<\/code> r\u1ed3i nh\u1eadp l\u1ea1i. Th\u00eam v\u00e0o <code>.env<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POSTGRES_USER=n8n\nPOSTGRES_PASSWORD=doi-mat-khau-manh\nPOSTGRES_DB=n8n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">R\u1ed3i d\u00f9ng file <code>compose.yaml<\/code> sau. Ph\u1ea7n <code>n8n<\/code> gi\u1eef nguy\u00ean c\u00e1c bi\u1ebfn \u1edf b\u01b0\u1edbc 5, ch\u1ec9 th\u00eam nh\u00f3m bi\u1ebfn <code>DB_*<\/code> v\u00e0 <code>depends_on<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  postgres:\n    image: postgres:17\n    restart: unless-stopped\n    environment:\n      - POSTGRES_USER=${POSTGRES_USER}\n      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}\n      - POSTGRES_DB=${POSTGRES_DB}\n    volumes:\n      - db_data:\/var\/lib\/postgresql\/data\n    healthcheck:\n      test: [\"CMD-SHELL\", \"pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}\"]\n      interval: 10s\n      timeout: 5s\n      retries: 5\n\n  n8n:\n    image: n8nio\/n8n:2.44.5\n    restart: unless-stopped\n    ports:\n      - \"127.0.0.1:5678:5678\"\n    environment:\n      - DB_TYPE=postgresdb\n      - DB_POSTGRESDB_HOST=postgres\n      - DB_POSTGRESDB_PORT=5432\n      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}\n      - DB_POSTGRESDB_USER=${POSTGRES_USER}\n      - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}\n      - N8N_HOST=${N8N_DOMAIN}\n      - N8N_PORT=5678\n      - N8N_PROTOCOL=https\n      - N8N_WEBHOOK_URL=https:\/\/${N8N_DOMAIN}\/\n      - N8N_PROXY_HOPS=1\n      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}\n      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true\n      - N8N_RESTRICT_FILE_ACCESS_TO=\/files\n      - NODE_ENV=production\n      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}\n      - TZ=${GENERIC_TIMEZONE}\n    volumes:\n      - n8n_data:\/home\/node\/.n8n\n      - .\/local-files:\/files\n    depends_on:\n      postgres:\n        condition: service_healthy\n\nvolumes:\n  n8n_data:\n  db_data:<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Image <code>postgres:17<\/code> l\u01b0u d\u1eef li\u1ec7u \u1edf <code>\/var\/lib\/postgresql\/data<\/code>. B\u1ea3n 18 \u0111\u1ed5i \u0111\u01b0\u1eddng d\u1eabn n\u00e0y, n\u00ean \u0111\u1ecdc ghi ch\u00fa c\u1ee7a image tr\u01b0\u1edbc khi d\u00f9ng. Chuy\u1ec3n m\u1ed9t n8n \u0111ang ch\u1ea1y SQLite sang PostgreSQL: <a href=\"https:\/\/tino.vn\/blog\/doi-database-n8n-tu-sqlite-sang-postgresql\/\">\u0111\u1ed5i database n8n t\u1eeb SQLite sang PostgreSQL<\/a>. Queue mode v\u00e0 tinh ch\u1ec9nh hi\u1ec7u n\u0103ng: <a href=\"https:\/\/tino.vn\/blog\/kinh-nghiem-toi-uu-hieu-suat-self-host-n8n\/\">kinh nghi\u1ec7m t\u1ed1i \u01b0u hi\u1ec7u su\u1ea5t self-host n8n<\/a>.<\/p>\n\n\n\n<h2 id=\"Sao_l\u01b0u_v\u00e0_c\u1eadp_nh\u1eadt_n8n_sau_khi_c\u00e0i_th\u1ebf_n\u00e0o?\">Sao l\u01b0u v\u00e0 c\u1eadp nh\u1eadt n8n sau khi c\u00e0i th\u1ebf n\u00e0o?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">B\u1ea3n sao l\u01b0u n8n \u0111\u1ea7y \u0111\u1ee7 g\u1ed3m volume n8n_data (ch\u1ee9a kh\u00f3a m\u00e3 h\u00f3a v\u00e0 file SQLite), database PostgreSQL n\u1ebfu c\u00f3, v\u00e0 file <code>.env<\/code>. L\u1ec7nh export c\u1ee7a n8n ch\u1ec9 l\u1ea5y workflow v\u00e0 credentials, kh\u00f4ng thay \u0111\u01b0\u1ee3c b\u1ea3n sao l\u01b0u \u0111\u1ea7y \u0111\u1ee7 (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/keep-n8n-running\/backup-and-restore\" rel=\"nofollow noopener\" target=\"_blank\">Back up and restore<\/a>). M\u1ecdi b\u1ea3n sao ph\u1ea3i \u0111\u01b0\u1ee3c ch\u00e9p ra ngo\u00e0i VPS.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1400\" height=\"750\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-sao-luu.webp\" alt=\"Sao l\u01b0u n8n t\u1ef1 host c\u1ea7n l\u1ea5y 4 th\u1ee9: volume n8n_data (th\u01b0 m\u1ee5c .n8n ch\u1ee9a kh\u00f3a m\u00e3 h\u00f3a v\u00e0 SQLite, d\u1eebng n8n tr\u01b0\u1edbc khi ch\u00e9p), database PostgreSQL b\u1eb1ng pg_dump n\u1ebfu d\u00f9ng, file compose.yaml v\u00e0 .env, export JSON b\u1eb1ng n8n export:workflow --backup v\u00e0 export:credentials --backup; sau \u0111\u00f3 l\u01b0u ra ngo\u00e0i VPS; thi\u1ebfu kh\u00f3a m\u00e3 h\u00f3a th\u00ec kh\u00f4ng gi\u1ea3i m\u00e3 \u0111\u01b0\u1ee3c credentials\" class=\"wp-image-131440\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-sao-luu.webp 1400w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-sao-luu-300x161.webp 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-sao-luu-1024x549.webp 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cach-cai-dat-n8n-tren-vps-sao-luu-768x411.webp 768w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">V\u1edbi SQLite, d\u1eebng n8n tr\u01b0\u1edbc khi n\u00e9n volume \u0111\u1ec3 file database kh\u00f4ng b\u1ecb ch\u00e9p d\u1edf. T\u00ean volume do Compose \u0111\u1eb7t theo t\u00ean th\u01b0 m\u1ee5c, ki\u1ec3m b\u1eb1ng <code>docker volume ls<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ~\/n8n-compose\ndocker compose stop n8n\ndocker run --rm -v n8n-compose_n8n_data:\/data -v \"$PWD\":\/backup alpine \\\n  tar czf \/backup\/n8n_data-$(date +%F).tar.gz -C \/data .\ndocker compose start n8n\n\n# N\u1ebfu d\u00f9ng PostgreSQL\ndocker compose exec -T postgres pg_dump -U n8n -d n8n &gt; n8n-db-$(date +%F).sql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Quy tr\u00ecnh \u0111\u1ea7y \u0111\u1ee7, k\u00e8m kh\u00f4i ph\u1ee5c: <a href=\"https:\/\/tino.vn\/blog\/cach-backup-va-restore-workflow-n8n\/\">c\u00e1ch backup v\u00e0 restore workflow n8n<\/a>. C\u1eadp nh\u1eadt n8n c\u00e0i b\u1eb1ng Compose g\u1ed3m: sao l\u01b0u, \u0111\u1ed5i tag image trong <code>compose.yaml<\/code>, r\u1ed3i ch\u1ea1y ba l\u1ec7nh d\u01b0\u1edbi.<\/p>\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\">Tr\u01b0\u1edbc khi l\u00ean b\u1ea3n l\u1edbn, \u0111\u1ecdc thay \u0111\u1ed5i trong release notes. n8n khuy\u00ean c\u1eadp nh\u1eadt t\u1ed1i thi\u1ec3u m\u1ed7i th\u00e1ng m\u1ed9t l\u1ea7n \u0111\u1ec3 kh\u00f4ng ph\u1ea3i nh\u1ea3y nhi\u1ec1u phi\u00ean b\u1ea3n. C\u00e1c l\u01b0u \u00fd khi t\u1eeb 1.x l\u00ean 2.x v\u00e0 khi s\u1eafp l\u00ean 3.0 n\u1eb1m \u1edf <a href=\"https:\/\/tino.vn\/blog\/cach-cap-nhat-n8n\/\">c\u00e1ch c\u1eadp nh\u1eadt n8n<\/a>.<\/p>\n\n\n\n<h2 id=\"C\u1ea7n_l\u00e0m_g\u00ec_\u0111\u1ec3_n8n_t\u1ef1_host_an_to\u00e0n_h\u01a1n?\">C\u1ea7n l\u00e0m g\u00ec \u0111\u1ec3 n8n t\u1ef1 host an to\u00e0n h\u01a1n?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">n8n t\u1ef1 host an to\u00e0n h\u01a1n khi ch\u1ec9 l\u1ed9 c\u1ed5ng 80 v\u00e0 443 qua reverse proxy, ch\u1ea1y b\u1ea3n \u0111\u01b0\u1ee3c v\u00e1 th\u01b0\u1eddng xuy\u00ean v\u00e0 gi\u1eef kh\u00f3a m\u00e3 h\u00f3a ngo\u00e0i VPS. n8n 2.0 \u0111\u00e3 b\u1eadt s\u1eb5n v\u00e0i l\u1edbp b\u1ea3o v\u1ec7: ch\u1eb7n Code node \u0111\u1ecdc bi\u1ebfn m\u00f4i tr\u01b0\u1eddng, t\u1eaft node Execute Command v\u00e0 Local File Trigger (<a href=\"https:\/\/docs.n8n.io\/changelog\/v20-breaking-changes\" rel=\"nofollow noopener\" target=\"_blank\">v2.0 breaking changes<\/a>).<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0110\u0103ng nh\u1eadp SSH b\u1eb1ng kh\u00f3a, t\u1eaft \u0111\u0103ng nh\u1eadp m\u1eadt kh\u1ea9u; xem th\u00eam <a href=\"https:\/\/tino.vn\/blog\/bao-mat-vps\/\">c\u00e1ch b\u1ea3o m\u1eadt VPS<\/a>.<\/li>\n\n\n<li>Kh\u00f4ng \u0111\u1ed5i c\u1ed5ng v\u1ec1 d\u1ea1ng <code>\"5678:5678\"<\/code>; gi\u1eef <code>127.0.0.1<\/code>.<\/li>\n\n\n<li>B\u1eadt x\u00e1c th\u1ef1c hai l\u1edbp cho owner, kh\u00f4ng d\u00f9ng chung t\u00e0i kho\u1ea3n.<\/li>\n\n\n<li>L\u01b0u API key trong m\u1ee5c Credentials, kh\u00f4ng ghi th\u1eb3ng v\u00e0o node Code; xem <a href=\"https:\/\/tino.vn\/blog\/bao-mat-credentials-va-api-keys-trong-n8n\/\">b\u1ea3o m\u1eadt credentials v\u00e0 API key trong n8n<\/a>.<\/li>\n\n\n<li>Ch\u1ec9 b\u1eadt l\u1ea1i Execute Command (qua bi\u1ebfn <code>NODES_EXCLUDE<\/code>) khi th\u1eadt c\u1ea7n v\u00e0 \u0111\u00e3 gi\u1edbi h\u1ea1n ng\u01b0\u1eddi d\u00f9ng.<\/li>\n<\/ul>\n\n\n\n<h2 id=\"L\u1ed7i_th\u01b0\u1eddng_g\u1eb7p_khi_c\u00e0i_n8n_tr\u00ean_VPS_v\u00e0_c\u00e1ch_s\u1eeda\">L\u1ed7i th\u01b0\u1eddng g\u1eb7p khi c\u00e0i n8n tr\u00ean VPS v\u00e0 c\u00e1ch s\u1eeda<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Ph\u1ea7n l\u1edbn l\u1ed7i khi c\u00e0i n8n tr\u00ean VPS n\u1eb1m \u1edf ba ch\u1ed7: quy\u1ec1n th\u01b0 m\u1ee5c, c\u1ea5u h\u00ecnh URL sau reverse proxy v\u00e0 t\u00ean mi\u1ec1n ch\u01b0a tr\u1ecf \u0111\u00fang. \u0110\u1ecdc log tr\u01b0\u1edbc khi s\u1eeda: <code>docker compose logs --tail=100 n8n<\/code>.<\/p>\n\n\n\n<h3 id=\"Container_kh\u1edfi_\u0111\u1ed9ng_l\u1ea1i_li\u00ean_t\u1ee5c,_log_b\u00e1o_&#8220;permission_denied&#8221;\">Container kh\u1edfi \u0111\u1ed9ng l\u1ea1i li\u00ean t\u1ee5c, log b\u00e1o &#8220;permission denied&#8221;<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Th\u01b0 m\u1ee5c g\u1eafn v\u00e0o container kh\u00f4ng thu\u1ed9c user 1000. Ch\u1ea1y <code>sudo chown -R 1000:1000 .\/local-files<\/code> r\u1ed3i <code>docker compose up -d<\/code>. L\u1ec7nh <code>docker compose up<\/code> kh\u00f4ng c\u00f3 t\u00f9y ch\u1ecdn \u0111\u1ed5i user; \u0111\u1eebng ch\u1ea1y container b\u1eb1ng root \u0111\u1ec3 n\u00e9 l\u1ed7i.<\/p>\n\n\n\n<h3 id=\"URL_webhook_trong_n8n_hi\u1ec7n_localhost:5678\">URL webhook trong n8n hi\u1ec7n localhost:5678<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Thi\u1ebfu <code>N8N_WEBHOOK_URL<\/code> ho\u1eb7c \u0111\u1eb7t sai. S\u1eeda trong <code>compose.yaml<\/code> th\u00e0nh <code>https:\/\/n8n.example.com\/<\/code>, ch\u1ea1y <code>docker compose up -d<\/code> \u0111\u1ec3 t\u1ea1o l\u1ea1i container. N\u1ebfu log b\u00e1o <code>WEBHOOK_URL<\/code> deprecated, \u0111\u1ed5i t\u00ean bi\u1ebfn sang <code>N8N_WEBHOOK_URL<\/code>.<\/p>\n\n\n\n<h3 id=\"Tr\u00ecnh_duy\u1ec7t_b\u00e1o_502_Bad_Gateway\">Tr\u00ecnh duy\u1ec7t b\u00e1o 502 Bad Gateway<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Reverse proxy ch\u1ea1y nh\u01b0ng n8n ch\u01b0a s\u1eb5n s\u00e0ng ho\u1eb7c \u0111\u00e3 d\u1eebng. Ki\u1ec3m tra <code>docker compose ps<\/code> v\u00e0 <code>curl -I http:\/\/127.0.0.1:5678<\/code>. N\u1ebfu container tho\u00e1t v\u00ec thi\u1ebfu RAM, xem <a href=\"https:\/\/tino.vn\/blog\/toi-uu-ram-va-cpu-cho-n8n-docker-tren-vps\/\">t\u1ed1i \u01b0u RAM v\u00e0 CPU cho n8n Docker<\/a>.<\/p>\n\n\n\n<h3 id=\"Caddy_ho\u1eb7c_Certbot_kh\u00f4ng_c\u1ea5p_\u0111\u01b0\u1ee3c_ch\u1ee9ng_ch\u1ec9\">Caddy ho\u1eb7c Certbot kh\u00f4ng c\u1ea5p \u0111\u01b0\u1ee3c ch\u1ee9ng ch\u1ec9<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">B\u1ea3n ghi A ch\u01b0a tr\u1ecf v\u1ec1 IP VPS, ho\u1eb7c c\u1ed5ng 80 b\u1ecb ch\u1eb7n. Ki\u1ec3m tra l\u1ea1i b\u1eb1ng <code>dig +short n8n.example.com<\/code> v\u00e0 <code>sudo ufw status<\/code>. L\u1ed7i khi workflow g\u1ecdi API b\u00ean ngo\u00e0i l\u00e0 chuy\u1ec7n kh\u00e1c, xem <a href=\"https:\/\/tino.vn\/blog\/loi-ket-noi-api-thuong-gap-trong-n8n\/\">l\u1ed7i k\u1ebft n\u1ed1i API th\u01b0\u1eddng g\u1eb7p trong n8n<\/a>.<\/p>\n\n\n\n<h2 id=\"Khi_n\u00e0o_n\u00ean_d\u00f9ng_VPS_c\u00e0i_s\u1eb5n_n8n_thay_v\u00ec_t\u1ef1_c\u00e0i?\">Khi n\u00e0o n\u00ean d\u00f9ng VPS c\u00e0i s\u1eb5n n8n thay v\u00ec t\u1ef1 c\u00e0i?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">VPS c\u00e0i s\u1eb5n n8n h\u1ee3p v\u1edbi ng\u01b0\u1eddi c\u1ea7n n8n ch\u1ea1y tr\u00ean m\u00e1y ch\u1ee7 ri\u00eang nh\u01b0ng kh\u00f4ng mu\u1ed1n t\u1ef1 l\u00e0m 8 b\u01b0\u1edbc \u1edf tr\u00ean, ho\u1eb7c kh\u00f4ng c\u00f3 ng\u01b0\u1eddi tr\u1ef1c khi m\u00e1y ch\u1ee7 l\u1ed7i. B\u1ea1n v\u1eabn ph\u1ea3i t\u1ef1 lo workflow, theo d\u00f5i phi\u00ean b\u1ea3n v\u00e0 sao l\u01b0u d\u1eef li\u1ec7u quan tr\u1ecdng. Kh\u00e1i ni\u1ec7m v\u00e0 c\u00e1ch ch\u1ecdn: <a href=\"https:\/\/tino.vn\/blog\/vps-n8n\/\">VPS n8n l\u00e0 g\u00ec<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/cach-cai-dat-n8n-tren-vps-6.png\" alt=\"3 b\u01b0\u1edbc b\u1eaft \u0111\u1ea7u v\u1edbi VPS n8n c\u1ee7a Tino\" class=\"wp-image-104921\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/cach-cai-dat-n8n-tren-vps-6.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/04\/cach-cai-dat-n8n-tren-vps-6-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u00e3 c\u00f3 VPS c\u00e0i s\u1eb5n n8n c\u1ee7a Tino, xem <a href=\"https:\/\/tino.vn\/blog\/dang-nhap-va-cau-hinh-vps-n8n\/\">c\u00e1ch \u0111\u0103ng nh\u1eadp v\u00e0 c\u1ea5u h\u00ecnh VPS n8n<\/a>.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Mu\u1ed1n ch\u1ea1y n8n 24\/7 m\u00e0 kh\u00f4ng t\u1ef1 c\u00e0i? <a href=\"https:\/\/tino.vn\/vps-n8n\">VPS n8n c\u1ee7a Tino<\/a> c\u00e0i s\u1eb5n n8n tr\u00ean VPS NVMe \u0111\u1eb7t t\u1ea1i Vi\u1ec7t Nam; b\u1ea1n v\u1eabn c\u00f3 quy\u1ec1n root \u0111\u1ec3 c\u1ea5u h\u00ecnh. Xem c\u1ea5u h\u00ecnh v\u00e0 gi\u00e1 tr\u00ean trang s\u1ea3n ph\u1ea9m.<\/p>\n<\/blockquote>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/tino.vn\/vps-n8n\">Xem VPS n8n<\/a><\/div>\n<\/div>\n\n\n\n<h2 id=\"Sau_khi_c\u00e0i_xong,_\u0111\u1ecdc_ti\u1ebfp_g\u00ec?\">Sau khi c\u00e0i xong, \u0111\u1ecdc ti\u1ebfp g\u00ec?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">C\u00e1c b\u00e0i d\u01b0\u1edbi \u0111\u00e2y \u0111i ti\u1ebfp t\u1eebng vi\u1ec7c v\u1eadn h\u00e0nh n8n t\u1ef1 host, theo th\u1ee9 t\u1ef1 th\u01b0\u1eddng g\u1eb7p:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/tino.vn\/blog\/cau-hinh-toi-thieu-de-trien-khai-vps-n8n\/\">C\u1ea5u h\u00ecnh VPS t\u1ed1i thi\u1ec3u cho n8n<\/a> v\u00e0 <a href=\"https:\/\/tino.vn\/blog\/toi-uu-ram-va-cpu-cho-n8n-docker-tren-vps\/\">t\u1ed1i \u01b0u RAM, CPU cho n8n Docker<\/a><\/li>\n\n\n<li><a href=\"https:\/\/tino.vn\/blog\/cau-hinh-nginx-reverse-proxy-va-ssl-cho-n8n\/\">Nginx reverse proxy v\u00e0 SSL cho n8n<\/a>, <a href=\"https:\/\/tino.vn\/blog\/chay-nhieu-instance-n8n-tren-cung-1-vps\/\">ch\u1ea1y nhi\u1ec1u instance n8n tr\u00ean m\u1ed9t VPS<\/a><\/li>\n\n\n<li><a href=\"https:\/\/tino.vn\/blog\/cach-backup-va-restore-workflow-n8n\/\">Backup v\u00e0 restore workflow n8n<\/a>, <a href=\"https:\/\/tino.vn\/blog\/cach-cap-nhat-n8n\/\">c\u1eadp nh\u1eadt n8n<\/a><\/li>\n\n\n<li><a href=\"https:\/\/tino.vn\/blog\/doi-database-n8n-tu-sqlite-sang-postgresql\/\">\u0110\u1ed5i SQLite sang PostgreSQL<\/a>, <a href=\"https:\/\/tino.vn\/blog\/kinh-nghiem-toi-uu-hieu-suat-self-host-n8n\/\">t\u1ed1i \u01b0u hi\u1ec7u su\u1ea5t self-host<\/a><\/li>\n\n\n<li><a href=\"https:\/\/tino.vn\/blog\/cai-dat-ngrok-va-tich-hop-n8n-tren-localhost\/\">Th\u1eed webhook tr\u00ean m\u00e1y t\u00ednh b\u1eb1ng ngrok<\/a>, <a href=\"https:\/\/tino.vn\/blog\/cach-dang-ky-mua-tai-khoan-n8n-tren-n8n-io\/\">\u0111\u0103ng k\u00fd t\u00e0i kho\u1ea3n n8n Cloud<\/a><\/li>\n<\/ul>\n\n\n\n<h2 id=\"C\u00e2u_h\u1ecfi_th\u01b0\u1eddng_g\u1eb7p\">C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p<\/h2>\n\n\n\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"n8n_c\u00f3_mi\u1ec5n_ph\u00ed_kh\u00f4ng?\">n8n c\u00f3 mi\u1ec5n ph\u00ed kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">B\u1ea3n Community t\u1ef1 host kh\u00f4ng m\u1ea5t ph\u00ed b\u1ea3n quy\u1ec1n; b\u1ea1n tr\u1ea3 ti\u1ec1n VPS v\u00e0 t\u1ef1 qu\u1ea3n tr\u1ecb. n8n Cloud ch\u1ec9 c\u00f3 b\u1ea3n d\u00f9ng th\u1eed, sau \u0111\u00f3 tr\u1ea3 ph\u00ed theo g\u00f3i. So s\u00e1nh chi ti\u1ebft \u1edf <a href=\"https:\/\/tino.vn\/blog\/uu-nhuoc-diem-cua-self-hosted-n8n\/\">b\u00e0i n8n c\u00f3 mi\u1ec5n ph\u00ed kh\u00f4ng v\u00e0 \u01b0u nh\u01b0\u1ee3c \u0111i\u1ec3m self-host<\/a>.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"VPS_c\u1ea7n_bao_nhi\u00eau_RAM_\u0111\u1ec3_ch\u1ea1y_n8n?\">VPS c\u1ea7n bao nhi\u00eau RAM \u0111\u1ec3 ch\u1ea1y n8n?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">n8n kh\u00f4ng c\u00f4ng b\u1ed1 m\u1ee9c c\u1ed1 \u0111\u1ecbnh; RAM ph\u1ee5 thu\u1ed9c d\u1eef li\u1ec7u m\u1ed7i l\u1ea7n ch\u1ea1y, node Code v\u00e0 s\u1ed1 workflow ch\u1ea1y c\u00f9ng l\u00fac. C\u00e1ch \u01b0\u1edbc l\u01b0\u1ee3ng theo nhu c\u1ea7u c\u00f3 \u1edf <a href=\"https:\/\/tino.vn\/blog\/cau-hinh-toi-thieu-de-trien-khai-vps-n8n\/\">b\u00e0i c\u1ea5u h\u00ecnh t\u1ed1i thi\u1ec3u<\/a>.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"C\u00f3_ch\u1ea1y_n8n_tr\u00ean_shared_hosting_\u0111\u01b0\u1ee3c_kh\u00f4ng?\">C\u00f3 ch\u1ea1y n8n tr\u00ean shared hosting \u0111\u01b0\u1ee3c kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">Th\u01b0\u1eddng l\u00e0 kh\u00f4ng, v\u00ec shared hosting kh\u00f4ng cho ch\u1ea1y ti\u1ebfn tr\u00ecnh n\u1ec1n v\u00e0 kh\u00f4ng c\u00f3 Docker. C\u00e1c tr\u01b0\u1eddng h\u1ee3p ngo\u1ea1i l\u1ec7 v\u00e0 l\u00fd do c\u00f3 \u1edf <a href=\"https:\/\/tino.vn\/blog\/n8n-co-chay-duoc-tren-hosting-khong\/\">b\u00e0i n8n c\u00f3 ch\u1ea1y \u0111\u01b0\u1ee3c tr\u00ean hosting kh\u00f4ng<\/a>.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"Mu\u1ed1n_th\u1eed_webhook_tr\u01b0\u1edbc_khi_l\u00ean_VPS_th\u00ec_l\u00e0m_sao?\">Mu\u1ed1n th\u1eed webhook tr\u01b0\u1edbc khi l\u00ean VPS th\u00ec l\u00e0m sao?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">Ch\u1ea1y n8n tr\u00ean m\u00e1y t\u00ednh r\u1ed3i d\u00f9ng ngrok ho\u1eb7c Cloudflare Tunnel \u0111\u1ec3 c\u00f3 URL c\u00f4ng khai t\u1ea1m th\u1eddi. L\u1ec7nh tunnel t\u00edch h\u1ee3p c\u0169 c\u1ee7a n8n \u0111\u00e3 b\u1ecb g\u1ee1 \u1edf 2.0. H\u01b0\u1edbng d\u1eabn: <a href=\"https:\/\/tino.vn\/blog\/cai-dat-ngrok-va-tich-hop-n8n-tren-localhost\/\">c\u00e0i ngrok v\u00e0 t\u00edch h\u1ee3p n8n tr\u00ean localhost<\/a>.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"M\u1ed9t_VPS_ch\u1ea1y_\u0111\u01b0\u1ee3c_nhi\u1ec1u_n8n_kh\u00f4ng?\">M\u1ed9t VPS ch\u1ea1y \u0111\u01b0\u1ee3c nhi\u1ec1u n8n kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">\u0110\u01b0\u1ee3c, m\u1ed7i instance c\u1ea7n th\u01b0 m\u1ee5c, volume, c\u1ed5ng n\u1ed9i b\u1ed9 v\u00e0 t\u00ean mi\u1ec1n ph\u1ee5 ri\u00eang, c\u00f9ng \u0111i qua m\u1ed9t reverse proxy. C\u00e1ch l\u00e0m \u1edf <a href=\"https:\/\/tino.vn\/blog\/chay-nhieu-instance-n8n-tren-cung-1-vps\/\">b\u00e0i ch\u1ea1y nhi\u1ec1u instance n8n tr\u00ean c\u00f9ng VPS<\/a>.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\n<script type=\"application\/ld+json\">\n\t{\n\t\t\"@context\": \"https:\/\/schema.org\",\n\t\t\"@type\": \"FAQPage\",\n\t\t\"mainEntity\": [\n\t\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"n8n c\u00f3 mi\u1ec5n ph\u00ed kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>B\u1ea3n Community t\u1ef1 host kh\u00f4ng m\u1ea5t ph\u00ed b\u1ea3n quy\u1ec1n; b\u1ea1n tr\u1ea3 ti\u1ec1n VPS v\u00e0 t\u1ef1 qu\u1ea3n tr\u1ecb. n8n Cloud ch\u1ec9 c\u00f3 b\u1ea3n d\u00f9ng th\u1eed, sau \u0111\u00f3 tr\u1ea3 ph\u00ed theo g\u00f3i. So s\u00e1nh chi ti\u1ebft \u1edf <a>b\u00e0i n8n c\u00f3 mi\u1ec5n ph\u00ed kh\u00f4ng v\u00e0 \u01b0u nh\u01b0\u1ee3c \u0111i\u1ec3m self-host<\/a>.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"VPS c\u1ea7n bao nhi\u00eau RAM \u0111\u1ec3 ch\u1ea1y n8n?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>n8n kh\u00f4ng c\u00f4ng b\u1ed1 m\u1ee9c c\u1ed1 \u0111\u1ecbnh; RAM ph\u1ee5 thu\u1ed9c d\u1eef li\u1ec7u m\u1ed7i l\u1ea7n ch\u1ea1y, node Code v\u00e0 s\u1ed1 workflow ch\u1ea1y c\u00f9ng l\u00fac. C\u00e1ch \u01b0\u1edbc l\u01b0\u1ee3ng theo nhu c\u1ea7u c\u00f3 \u1edf <a>b\u00e0i c\u1ea5u h\u00ecnh t\u1ed1i thi\u1ec3u<\/a>.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"C\u00f3 ch\u1ea1y n8n tr\u00ean shared hosting \u0111\u01b0\u1ee3c kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Th\u01b0\u1eddng l\u00e0 kh\u00f4ng, v\u00ec shared hosting kh\u00f4ng cho ch\u1ea1y ti\u1ebfn tr\u00ecnh n\u1ec1n v\u00e0 kh\u00f4ng c\u00f3 Docker. C\u00e1c tr\u01b0\u1eddng h\u1ee3p ngo\u1ea1i l\u1ec7 v\u00e0 l\u00fd do c\u00f3 \u1edf <a>b\u00e0i n8n c\u00f3 ch\u1ea1y \u0111\u01b0\u1ee3c tr\u00ean hosting kh\u00f4ng<\/a>.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"Mu\u1ed1n th\u1eed webhook tr\u01b0\u1edbc khi l\u00ean VPS th\u00ec l\u00e0m sao?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Ch\u1ea1y n8n tr\u00ean m\u00e1y t\u00ednh r\u1ed3i d\u00f9ng ngrok ho\u1eb7c Cloudflare Tunnel \u0111\u1ec3 c\u00f3 URL c\u00f4ng khai t\u1ea1m th\u1eddi. L\u1ec7nh tunnel t\u00edch h\u1ee3p c\u0169 c\u1ee7a n8n \u0111\u00e3 b\u1ecb g\u1ee1 \u1edf 2.0. H\u01b0\u1edbng d\u1eabn: <a>c\u00e0i ngrok v\u00e0 t\u00edch h\u1ee3p n8n tr\u00ean localhost<\/a>.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"M\u1ed9t VPS ch\u1ea1y \u0111\u01b0\u1ee3c nhi\u1ec1u n8n kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>\u0110\u01b0\u1ee3c, m\u1ed7i instance c\u1ea7n th\u01b0 m\u1ee5c, volume, c\u1ed5ng n\u1ed9i b\u1ed9 v\u00e0 t\u00ean mi\u1ec1n ph\u1ee5 ri\u00eang, c\u00f9ng \u0111i qua m\u1ed9t reverse proxy. C\u00e1ch l\u00e0m \u1edf <a>b\u00e0i ch\u1ea1y nhi\u1ec1u instance n8n tr\u00ean c\u00f9ng VPS<\/a>.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t\t\t\t]\n\t}\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>C\u00e1ch c\u00e0i n8n tr\u00ean VPS \u0111\u01b0\u1ee3c t\u00e0i li\u1ec7u n8n h\u01b0\u1edbng d\u1eabn l\u00e0 ch\u1ea1y b\u1eb1ng Docker Compose: c\u00e0i Docker Engine v\u00e0 Compose v2, tr\u1ecf m\u1ed9t t\u00ean mi\u1ec1n ph\u1ee5 v\u1ec1 IP VPS, t\u1ea1o file .env v\u00e0 compose.yaml, r\u1ed3i \u0111\u1ec3 reverse proxy c\u1ea5p HTTPS. B\u1ea1n c\u1ea7n VPS Ubuntu 24.04 LTS, quy\u1ec1n sudo v\u00e0 kho\u1ea3ng 30 ph\u00fat. H\u01b0\u1edbng d\u1eabn [&hellip;]<\/p>\n","protected":false},"author":23,"featured_media":104922,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7397],"tags":[7343],"class_list":["post-104896","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-n8n","tag-n8n"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/104896","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=104896"}],"version-history":[{"count":14,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/104896\/revisions"}],"predecessor-version":[{"id":131598,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/104896\/revisions\/131598"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/104922"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=104896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/categories?post=104896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=104896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}