179 lines
5.2 KiB
Plaintext
179 lines
5.2 KiB
Plaintext
# ==============================================================================
|
|
# Acupedia Platform — QA Containerized Nginx Gateway Configuration
|
|
# File: config/nginx/acupedia.qa.conf
|
|
#
|
|
# Domain: qa.acupedia.in (and optional api-qa.acupedia.in)
|
|
#
|
|
# Container Upstreams:
|
|
# - Backend API -> backend:8000
|
|
# - Storefront -> store:80
|
|
# - Admin Suite -> admin:80
|
|
# - MinIO S3 -> minio:9000
|
|
# ==============================================================================
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Upstream Definitions (Docker Internal DNS on acupedia-net)
|
|
# ------------------------------------------------------------------------------
|
|
upstream backend_api {
|
|
server backend:8000;
|
|
keepalive 32;
|
|
}
|
|
|
|
upstream store_app {
|
|
server store:80;
|
|
keepalive 16;
|
|
}
|
|
|
|
upstream admin_app {
|
|
server admin:80;
|
|
keepalive 16;
|
|
}
|
|
|
|
upstream minio_storage {
|
|
server minio:9000;
|
|
keepalive 32;
|
|
}
|
|
|
|
# ==============================================================================
|
|
# 1. HTTP to HTTPS Global Redirect (Ports 80 -> 443)
|
|
# ==============================================================================
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name qa.acupedia.in api-qa.acupedia.in;
|
|
|
|
# Let's Encrypt ACME challenge (used for certbot renewal)
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
# Redirect all HTTP requests to HTTPS
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
# ==============================================================================
|
|
# 2. QA Dedicated API Subdomain (api-qa.acupedia.in) - Optional
|
|
# ==============================================================================
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name api-qa.acupedia.in;
|
|
|
|
# SSL Certificates (Mounted from host /etc/letsencrypt)
|
|
ssl_certificate /etc/letsencrypt/live/qa.acupedia.in/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/qa.acupedia.in/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_prefer_server_ciphers off;
|
|
|
|
client_max_body_size 50M;
|
|
|
|
# Common Proxy Headers
|
|
proxy_http_version 1.1;
|
|
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_connect_timeout 60s;
|
|
proxy_send_timeout 120s;
|
|
proxy_read_timeout 120s;
|
|
|
|
# Mobile App redirects
|
|
location /cart {
|
|
return 301 https://qa.acupedia.in$request_uri;
|
|
}
|
|
|
|
location /checkout {
|
|
return 301 https://qa.acupedia.in$request_uri;
|
|
}
|
|
|
|
# MinIO S3 Presigned Media Proxy (/acupedia-media/)
|
|
location /acupedia-media/ {
|
|
proxy_pass http://minio_storage;
|
|
proxy_set_header Host $http_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;
|
|
}
|
|
|
|
# FastAPI Swagger Docs & OpenAPI Schema
|
|
location /docs {
|
|
proxy_pass http://backend_api/docs;
|
|
}
|
|
|
|
location /openapi.json {
|
|
proxy_pass http://backend_api/openapi.json;
|
|
}
|
|
|
|
# Route all API traffic to FastAPI Backend on port 8000
|
|
location / {
|
|
proxy_pass http://backend_api;
|
|
}
|
|
}
|
|
|
|
# ==============================================================================
|
|
# 3. QA Main Domain: Storefront (/), Admin (/admin), API (/api/), Docs (/docs)
|
|
# ==============================================================================
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name qa.acupedia.in;
|
|
|
|
# SSL Certificates (Mounted from host /etc/letsencrypt)
|
|
ssl_certificate /etc/letsencrypt/live/qa.acupedia.in/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/qa.acupedia.in/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_prefer_server_ciphers off;
|
|
|
|
client_max_body_size 50M;
|
|
|
|
# Common Proxy Headers
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
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_connect_timeout 60s;
|
|
proxy_send_timeout 120s;
|
|
proxy_read_timeout 120s;
|
|
|
|
# Admin Panel (/admin)
|
|
location /admin {
|
|
proxy_pass http://admin_app;
|
|
}
|
|
|
|
# Backend API access via same-origin (qa.acupedia.in/api/ -> avoids CORS)
|
|
location /api/ {
|
|
proxy_pass http://backend_api/api/;
|
|
}
|
|
|
|
# FastAPI Swagger Docs (/docs)
|
|
location /docs {
|
|
proxy_pass http://backend_api/docs;
|
|
}
|
|
|
|
location /openapi.json {
|
|
proxy_pass http://backend_api/openapi.json;
|
|
}
|
|
|
|
# MinIO S3 Presigned Media Proxy (/acupedia-media/)
|
|
location /acupedia-media/ {
|
|
proxy_pass http://minio_storage;
|
|
proxy_set_header Host $http_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;
|
|
}
|
|
|
|
# Storefront Customer Web App (/)
|
|
location / {
|
|
proxy_pass http://store_app;
|
|
}
|
|
}
|