Files
qlockify-core-deployment/nginx/nginx.conf
2026-03-15 10:20:55 +08:00

56 lines
1.6 KiB
Nginx Configuration File

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;
}
}