{"id":34307,"date":"2025-12-07T16:53:48","date_gmt":"2025-12-07T09:53:48","guid":{"rendered":"https:\/\/dps.media\/?p=34307"},"modified":"2025-12-07T16:53:51","modified_gmt":"2025-12-07T09:53:51","slug":"guide-to-self-hosting-supabase-on-fastpanel-with-docker-portainer-resolving-port-conflicts","status":"publish","type":"post","link":"https:\/\/dps.media\/en\/guide-to-self-hosting-supabase-on-fastpanel-with-docker-portainer-resolving-port-conflicts\/","title":{"rendered":"Guide to Self-Hosting Supabase on Fastpanel with Docker &amp; Portainer (Resolving Port Conflicts)"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p class=\"wp-block-paragraph\">Want to run Supabase (Firebase Alternative) on VPS Fastpanel but encountering port 8000\/3000 conflict errors? This article provides detailed instructions on deploying Supabase with Docker, separating domains for API and Studio Dashboard for the most stable system operation.<\/p><p class=\"wp-block-paragraph\">Supabase is a great open-source alternative to Firebase. However, self-hosting Supabase on a VPS with a pre-installed Control Panel (such as Fastpanel, CyberPanel\u2026) often faces many difficulties, especially the issue <strong>Reverse Proxy<\/strong> v\u00e0 <strong>Port Conflict<\/strong>.<\/p><p class=\"wp-block-paragraph\">By default, Supabase uses port <code data-no-translation=\"\">8000<\/code> for API Gateway, this port is often conflicted by other services (like Portainer or default Nginx). Additionally, the admin Dashboard (Supabase Studio) runs on port <code data-no-translation=\"\">3000<\/code> and needs to be properly configured to access.<\/p><p class=\"wp-block-paragraph\">In this article, <strong>DPS Media<\/strong> will share experience deploying Supabase on Ubuntu 24.04 using Fastpanel, with custom port configuration: <strong>API runs on port 8008<\/strong> v\u00e0 <strong>Studio runs on port 3003<\/strong>.<\/p><h2 class=\"wp-block-heading\">1. Chu\u1ea9n b\u1ecb t\u00e0i nguy\u00ean<\/h2><ul class=\"wp-block-list\">\n<li><strong>VPS:<\/strong> Ubuntu 22.04 or 24.04 (Recommended minimum 4GB RAM).<\/li>\n\n\n\n<li><strong>Fastpanel:<\/strong> Pre-installed.<\/li>\n\n\n\n<li><strong>Docker &amp; Portainer:<\/strong> Installed (See previous guide).<\/li>\n\n\n\n<li><strong>Domain name:<\/strong> You need to prepare 2 subdomains:\n<ul class=\"wp-block-list\">\n<li><code data-no-translation=\"\">studio.domain.com<\/code>: Used for management interface.<\/li>\n\n\n\n<li><code data-no-translation=\"\">spb.domain.com<\/code>: Used for API backend.<\/li>\n<\/ul>\n<\/li>\n<\/ul><h2 class=\"wp-block-heading\">2. Download Supabase source code<\/h2><p class=\"wp-block-paragraph\">Access SSH to VPS with root privileges and download Supabase's Docker deploy kit:<\/p><p class=\"wp-block-paragraph\">Bash<\/p><pre class=\"wp-block-code\" data-no-translation=\"\"><code data-no-translation=\"\"># Di chuy\u1ec3n \u0111\u1ebfn th\u01b0 m\u1ee5c l\u00e0m vi\u1ec7c\ncd \/opt\n\n# T\u1ea3i source code t\u1eeb Github\ngit clone --depth 1 https:\/\/github.com\/supabase\/supabase\n\n# V\u00e0o th\u01b0 m\u1ee5c ch\u1ee9a c\u1ea5u h\u00ecnh Docker\ncd supabase\/docker\n<\/code><\/pre><h2 class=\"wp-block-heading\">3. Configure Docker Compose (Avoid port conflicts)<\/h2><p class=\"wp-block-paragraph\">This is the most important step. We will not use the default port (8000) to avoid conflicts with Portainer or other services.<\/p><p class=\"wp-block-paragraph\">Open file <code data-no-translation=\"\">docker-compose.yml<\/code>:<\/p><p class=\"wp-block-paragraph\">Bash<\/p><pre class=\"wp-block-code\" data-no-translation=\"\"><code data-no-translation=\"\">nano docker-compose.yml\n<\/code><\/pre><p class=\"wp-block-paragraph\"><strong>Make 2 important changes:<\/strong><\/p><ol start=\"1\" class=\"wp-block-list\">\n<li><strong>Open port for Studio (Interface):<\/strong> Find service <code data-no-translation=\"\">studio<\/code>, add section <code data-no-translation=\"\">ports<\/code> to map port 3003 of VPS to port 3000 of container.<\/li>\n\n\n\n<li><strong>Change port for Kong (API):<\/strong> Find service <code data-no-translation=\"\">kong<\/code>, change map port to 8008.<\/li>\n<\/ol><p class=\"wp-block-paragraph\">The modified code will look like this:<\/p><p class=\"wp-block-paragraph\">YAML<\/p><pre class=\"wp-block-code\" data-no-translation=\"\"><code data-no-translation=\"\">services:\n  studio:\n    image: supabase\/studio:2025...\n    # ... c\u00e1c config kh\u00e1c gi\u1eef nguy\u00ean\n    ports:\n      - \"3003:3000\"  # Map Host 3003 -> Container 3000\n\n  kong:\n    image: kong:2.8.1\n    # ... c\u00e1c config kh\u00e1c gi\u1eef nguy\u00ean\n    ports:\n      - \"8008:8000\/tcp\" # Map Host 8008 -> Container 8000 (API)\n      - \"${KONG_HTTPS_PORT}:8443\/tcp\"\n<\/code><\/pre><h2 class=\"wp-block-heading\">4. Configure environment variables (.env)<\/h2><p class=\"wp-block-paragraph\">Copy sample file and edit:<\/p><p class=\"wp-block-paragraph\">Bash<\/p><pre class=\"wp-block-code\" data-no-translation=\"\"><code data-no-translation=\"\">cp .env.example .env\nnano .env\n<\/code><\/pre><p class=\"wp-block-paragraph\">You need to fill in strong passwords (Database, JWT Secret) and most importantly configure the URL to match the 2 prepared subdomains.<\/p><p class=\"wp-block-paragraph\"><strong>Mandatory parameters to edit:<\/strong><\/p><p class=\"wp-block-paragraph\">Bash<\/p><pre class=\"wp-block-code\" data-no-translation=\"\"><code data-no-translation=\"\"># 1. B\u1ea3o m\u1eadt (T\u1ef1 t\u1ea1o chu\u1ed7i ng\u1eabu nhi\u00ean m\u1ea1nh)\nPOSTGRES_PASSWORD=MatKhauDbCucManh!!!\nJWT_SECRET=Chuoi_JWT_Bi_Mat_Dai_It_Nhat_32_Ky_Tu\nDASHBOARD_PASSWORD=MatKhauDangNhapWeb!!!\n\n# 2. C\u1ea5u h\u00ecnh Port API (Ph\u1ea3i kh\u1edbp v\u1edbi file yml \u1edf tr\u00ean)\nKONG_HTTP_PORT=8008\n\n# 3. C\u1ea5u h\u00ecnh Domain (Quan tr\u1ecdng)\n# SITE_URL: L\u00e0 \u0111\u1ecba ch\u1ec9 truy c\u1eadp Giao di\u1ec7n Studio\nSITE_URL=https:\/\/studio.domain.com\n\n# SUPABASE_PUBLIC_URL: L\u00e0 \u0111\u1ecba ch\u1ec9 API (Studio s\u1ebd g\u1ecdi v\u00e0o link n\u00e0y \u0111\u1ec3 l\u1ea5y data)\n# L\u01afU \u00dd: Ph\u1ea3i \u0111i\u1ec1n domain API, KH\u00d4NG \u0111i\u1ec1n domain Studio\nSUPABASE_PUBLIC_URL=https:\/\/spb.domain.com\n\n# API Auth: C\u0169ng tr\u1ecf v\u1ec1 domain API\nAPI_EXTERNAL_URL=https:\/\/spb.domain.com\n\n# Redirect URL: Th\u00eam c\u1ea3 domain studio v\u00e0o \u0111\u1ec3 login xong quay v\u1ec1 \u0111\u00fang ch\u1ed7\nADDITIONAL_REDIRECT_URLS=https:\/\/studio.domain.com,https:\/\/spb.domain.com\n<\/code><\/pre><h2 class=\"wp-block-heading\">5. Start Supabase<\/h2><p class=\"wp-block-paragraph\">After configuration is complete, run the following command for Docker to download and build the system:<\/p><p class=\"wp-block-paragraph\">Bash<\/p><pre class=\"wp-block-code\" data-no-translation=\"\"><code data-no-translation=\"\">docker compose up -d\n<\/code><\/pre><p class=\"wp-block-paragraph\"><em>Note: This process may take 5-10 minutes to download about 1GB images.<\/em><\/p><h2 class=\"wp-block-heading\">6. Configure Reverse Proxy on Fastpanel<\/h2><p class=\"wp-block-paragraph\">To access the web without typing <code data-no-translation=\"\">IP:3003<\/code>, we use the Proxy feature of Fastpanel.<\/p><h3 class=\"wp-block-heading\">Page 1: Management interface (Studio)<\/h3><ol start=\"1\" class=\"wp-block-list\">\n<li>Create new site: <strong>Reverse Proxy<\/strong>.<\/li>\n\n\n\n<li>Domain: <code data-no-translation=\"\">studio.domain.com<\/code>.<\/li>\n\n\n\n<li>Upstream: <code data-no-translation=\"\">http:\/\/127.0.0.1:3003<\/code>.<\/li>\n\n\n\n<li><strong>C\u1ef1c k\u1ef3 quan tr\u1ecdng:<\/strong> Go to Settings -&gt; Static Content -&gt; <strong>TURN OFF<\/strong> line <em>\u201cUse NGINX for static files\u201d<\/em>.<\/li>\n\n\n\n<li>Install Let\u2019s Encrypt SSL.<\/li>\n<\/ol><h3 class=\"wp-block-heading\">Page 2: API Backend (Supabase)<\/h3><ol start=\"1\" class=\"wp-block-list\">\n<li>Create new site: <strong>Reverse Proxy<\/strong>.<\/li>\n\n\n\n<li>Domain: <code data-no-translation=\"\">spb.domain.com<\/code>.<\/li>\n\n\n\n<li>Upstream: <code data-no-translation=\"\">http:\/\/127.0.0.1:8008<\/code>.<\/li>\n\n\n\n<li>C\u0169ng <strong>TURN OFF<\/strong> line <em>\u201cUse NGINX for static files\u201d<\/em>.<\/li>\n\n\n\n<li>Install Let\u2019s Encrypt SSL.<\/li>\n<\/ol><p class=\"wp-block-paragraph\"><em>(Note: Page <code data-no-translation=\"\">spb<\/code> when accessed directly will report 404 Not Found error, this is normal because API Gateway has no interface).<\/em><\/p><h2 class=\"wp-block-heading\">7. Result &amp; Login<\/h2><p class=\"wp-block-paragraph\">Now you access: <strong><code data-no-translation=\"\">https:\/\/studio.domain.com<\/code><\/strong><\/p><ul class=\"wp-block-list\">\n<li>Log in with account: <code data-no-translation=\"\">supabase<\/code> \/ Password you set in <code data-no-translation=\"\">.env<\/code>.<\/li>\n<\/ul><p class=\"wp-block-paragraph\"><strong>Connection parameters for Dev:<\/strong><\/p><ul class=\"wp-block-list\">\n<li><strong>Project URL:<\/strong> <code data-no-translation=\"\">https:\/\/spb.domain.com<\/code><\/li>\n\n\n\n<li><strong>Anon\/Service Key:<\/strong> Get in Dashboard (Settings -&gt; API).<\/li>\n<\/ul><h2 class=\"wp-block-heading\">Conclusion<\/h2><p class=\"wp-block-paragraph\">Separation <strong>Studio (Port 3003)<\/strong> v\u00e0 <strong>API (Port 8008<\/strong> helps the Supabase system run smoothly on Fastpanel without interfering with other default services. Hope this guide helps you take control of your powerful Backend infrastructure.<\/p><hr class=\"wp-block-separator has-alpha-channel-opacity\"><p class=\"wp-block-paragraph\"><em>Source: <a class=\"wpil_keyword_link\" href=\"https:\/\/dps.media\/en\/\" title=\"DPS.MEDIA JSC\" data-wpil-keyword-link=\"linked\" data-wpil-monitor-id=\"588\">dps.media<\/a><\/em><\/p><p class=\"wp-block-paragraph\"><\/p>","protected":false},"excerpt":{"rendered":"<p>B\u1ea1n mu\u1ed1n ch\u1ea1y Supabase (Firebase Alternative) tr\u00ean VPS Fastpanel nh\u01b0ng g\u1eb7p l\u1ed7i xung \u0111\u1ed9t c\u1ed5ng 8000\/3000? B\u00e0i vi\u1ebft n\u00e0y h\u01b0\u1edbng d\u1eabn chi ti\u1ebft c\u00e1ch deploy Supabase v\u1edbi Docker, t\u00e1ch ri\u00eang domain cho API v\u00e0 Studio Dashboard \u0111\u1ec3 h\u1ec7 th\u1ed1ng ho\u1ea1t \u0111\u1ed9ng \u1ed5n \u0111\u1ecbnh nh\u1ea5t.Supabase l\u00e0 m\u1ed9t gi\u1ea3i ph\u00e1p thay th\u1ebf m\u00e3 ngu\u1ed3n m\u1edf tuy\u1ec7t v\u1eddi [&hellip;]<\/p>","protected":false},"author":1,"featured_media":34308,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,1621],"tags":[],"class_list":["post-34307","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","category-fastpanel"],"acf":[],"rankmath_keywords":{"primary":"","secondary":[""]},"yoast_keywords":{"primary":"","secondary":[]},"yoast_focuskw":"","rankmath_focuskw":"","seo_keywords":{"primary":"","secondary":[""]},"_links":{"self":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts\/34307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/comments?post=34307"}],"version-history":[{"count":0,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/posts\/34307\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/media\/34308"}],"wp:attachment":[{"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/media?parent=34307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/categories?post=34307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dps.media\/en\/wp-json\/wp\/v2\/tags?post=34307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}