目录

Supabase配置

目录

https://www.ffeeii.com/ffeeii.com/2025/08/supabase.png

上次飞哥写了一篇文章阿里、腾讯、字节、n8n都选择了Supabase,可见Supabase的战略地位 最多的问题是如何安装 Supabase

推荐采用Docker方式安装

git clonehttps://github.com/supabase/supabase
cd supabase/docker

cp .env.example .env

docker compose up

.env 配置参数说明

# pg数据库密码
POSTGRES_PASSWORD 

docker-compose.yml

NEXT_PUBLIC_ENABLE_LOGS: false

nginx 配置

server {
    listen 80;
    listen 443 ssl;  # 合并监听端口
    server_name supabase.xxx.xxx;

    # SSL配置(仅443生效)
    ssl_certificate /etc/nginx/ssl/xxx.xxx.crt;
    ssl_certificate_key /etc/nginx/ssl/xxx.xxx.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    client_max_body_size 50M;

    location / {
        proxy_pass http://localhost:3002; # Supabase Studio
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /auth/v1/ {
        proxy_pass http://localhost:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /rest/v1/ {
        proxy_pass http://localhost:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /storage/v1/ {
        proxy_pass http://localhost:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /realtime/v1/ {
        proxy_pass http://localhost:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Connection "upgrade";
        proxy_set_header Upgrade $http_upgrade;
    }
}