initial commit

This commit is contained in:
2026-03-15 10:20:55 +08:00
commit ed47645fef
11 changed files with 255 additions and 0 deletions

1
nginx/.htpasswd Normal file
View File

@@ -0,0 +1 @@
admin:$2y$05$gSZ4s3BN8TsEc.pS/vaZi.v/AMrIozncWtFDGkNOglJlv59f7jc7i

55
nginx/nginx.conf Normal file
View File

@@ -0,0 +1,55 @@
server {
listen 80;
server_name localhost;
client_max_body_size 100M;
sendfile on;
# Static and Media files
location /static/ {
alias /usr/share/nginx/html/staticfiles/;
expires 30d;
access_log off;
}
location /media/ {
alias /usr/share/nginx/html/mediafiles/;
expires 30d;
access_log off;
}
# Protect API Documentation with Basic Auth (from your old project)
location ~ ^/(docs|redoc|openapi.json|api/docs|api/redoc|api/openapi.json|api/v1/docs) {
auth_basic "Restricted API Documentation";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://backend: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;
}
# Standard API Proxy
location /api/ {
proxy_pass http://backend: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;
}
# Admin Panel Proxy
location /admin/ {
proxy_pass http://backend: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;
}
# Frontend Proxy
location / {
proxy_pass http://frontend:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}