# HTTPS 配置示例
# 将此内容添加到 gateway.conf 中

# 生产环境 - API (HTTPS)
server {
    listen 443 ssl http2;
    server_name api.pinzhuhui.com;

    ssl_certificate /etc/nginx/certs/api.pinzhuhui.com.crt;
    ssl_certificate_key /etc/nginx/certs/api.pinzhuhui.com.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    location / {
        limit_req zone=api_limit burst=50 nodelay;
        proxy_pass http://prod_api;
        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;
        client_max_body_size 50m;
    }
}

# HTTP 重定向到 HTTPS
server {
    listen 80;
    server_name api.pinzhuhui.com;
    return 301 https://$server_name$request_uri;
}

# 生产环境 - 商家后台 (HTTPS)
server {
    listen 443 ssl http2;
    server_name merchant.pinzhuhui.com;

    ssl_certificate /etc/nginx/certs/merchant.pinzhuhui.com.crt;
    ssl_certificate_key /etc/nginx/certs/merchant.pinzhuhui.com.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    location / {
        proxy_pass http://prod_merchant;
        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;
    }
}

server {
    listen 80;
    server_name merchant.pinzhuhui.com;
    return 301 https://$server_name$request_uri;
}

# 其他域名同理配置...
