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.
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…) often faces many difficulties, especially the issue Reverse Proxy và Port Conflict.
By default, Supabase uses port 8000 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 3000 and needs to be properly configured to access.
In this article, DPS Media will share experience deploying Supabase on Ubuntu 24.04 using Fastpanel, with custom port configuration: API runs on port 8008 và Studio runs on port 3003.
1. Chuẩn bị tài nguyên
- VPS: Ubuntu 22.04 or 24.04 (Recommended minimum 4GB RAM).
- Fastpanel: Pre-installed.
- Docker & Portainer: Installed (See previous guide).
- Domain name: You need to prepare 2 subdomains:
studio.domain.com: Used for management interface.spb.domain.com: Used for API backend.
2. Download Supabase source code
Access SSH to VPS with root privileges and download Supabase's Docker deploy kit:
Bash
# Di chuyển đến thư mục làm việc
cd /opt
# Tải source code từ Github
git clone --depth 1 https://github.com/supabase/supabase
# Vào thư mục chứa cấu hình Docker
cd supabase/docker
3. Configure Docker Compose (Avoid port conflicts)
This is the most important step. We will not use the default port (8000) to avoid conflicts with Portainer or other services.
Open file docker-compose.yml:
Bash
nano docker-compose.yml
Make 2 important changes:
- Open port for Studio (Interface): Find service
studio, add sectionportsto map port 3003 of VPS to port 3000 of container. - Change port for Kong (API): Find service
kong, change map port to 8008.
The modified code will look like this:
YAML
services:
studio:
image: supabase/studio:2025...
# ... các config khác giữ nguyên
ports:
- "3003:3000" # Map Host 3003 -> Container 3000
kong:
image: kong:2.8.1
# ... các config khác giữ nguyên
ports:
- "8008:8000/tcp" # Map Host 8008 -> Container 8000 (API)
- "${KONG_HTTPS_PORT}:8443/tcp"
4. Configure environment variables (.env)
Copy sample file and edit:
Bash
cp .env.example .env
nano .env
You need to fill in strong passwords (Database, JWT Secret) and most importantly configure the URL to match the 2 prepared subdomains.
Mandatory parameters to edit:
Bash
# 1. Bảo mật (Tự tạo chuỗi ngẫu nhiên mạnh)
POSTGRES_PASSWORD=MatKhauDbCucManh!!!
JWT_SECRET=Chuoi_JWT_Bi_Mat_Dai_It_Nhat_32_Ky_Tu
DASHBOARD_PASSWORD=MatKhauDangNhapWeb!!!
# 2. Cấu hình Port API (Phải khớp với file yml ở trên)
KONG_HTTP_PORT=8008
# 3. Cấu hình Domain (Quan trọng)
# SITE_URL: Là địa chỉ truy cập Giao diện Studio
SITE_URL=https://studio.domain.com
# SUPABASE_PUBLIC_URL: Là địa chỉ API (Studio sẽ gọi vào link này để lấy data)
# LƯU Ý: Phải điền domain API, KHÔNG điền domain Studio
SUPABASE_PUBLIC_URL=https://spb.domain.com
# API Auth: Cũng trỏ về domain API
API_EXTERNAL_URL=https://spb.domain.com
# Redirect URL: Thêm cả domain studio vào để login xong quay về đúng chỗ
ADDITIONAL_REDIRECT_URLS=https://studio.domain.com,https://spb.domain.com
5. Start Supabase
After configuration is complete, run the following command for Docker to download and build the system:
Bash
docker compose up -d
Note: This process may take 5-10 minutes to download about 1GB images.
6. Configure Reverse Proxy on Fastpanel
To access the web without typing IP:3003, we use the Proxy feature of Fastpanel.
Page 1: Management interface (Studio)
- Create new site: Reverse Proxy.
- Domain:
studio.domain.com. - Upstream:
http://127.0.0.1:3003. - Cực kỳ quan trọng: Go to Settings -> Static Content -> TURN OFF line “Use NGINX for static files”.
- Install Let’s Encrypt SSL.
Page 2: API Backend (Supabase)
- Create new site: Reverse Proxy.
- Domain:
spb.domain.com. - Upstream:
http://127.0.0.1:8008. - Cũng TURN OFF line “Use NGINX for static files”.
- Install Let’s Encrypt SSL.
(Note: Page spb when accessed directly will report 404 Not Found error, this is normal because API Gateway has no interface).
7. Result & Login
Now you access: https://studio.domain.com
- Log in with account:
supabase/ Password you set in.env.
Connection parameters for Dev:
- Project URL:
https://spb.domain.com - Anon/Service Key: Get in Dashboard (Settings -> API).
Conclusion
Separation Studio (Port 3003) và API (Port 8008 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.
Source: dps.media
Ý kiến bạn đọc (0)
Đăng nhập để bình luận
Đăng nhập nhanh 1-chạm bằng Google để chia sẻ ý kiến của bạn về bài viết.
Bằng cách đăng nhập, bạn đồng ý với điều khoản và chính sách cộng đồng.
Chưa có bình luận nào. Hãy là người đầu tiên chia sẻ cảm nghĩ!
Đăng nhập / Tạo tài khoản
Đăng nhập với Google để gửi bình luận và tương tác cùng cộng đồng.
Tiếp tục là đồng ý với điều khoản sử dụng và chính sách bảo mật của DPS Media.