Download deploy/nginx.conf.example from StillWorking/sentinel-face-recognition: direct link, hf CLI and curl.
- Browser
- Download file 3.17 kB
-
https://huggingface.co/StillWorking/sentinel-face-recognition/resolve/main/deploy/nginx.conf.example
- Command line
-
hf download hf://StillWorking/sentinel-face-recognition/deploy/nginx.conf.example
-
curl -L -o nginx.conf.example https://huggingface.co/StillWorking/sentinel-face-recognition/resolve/main/deploy/nginx.conf.example
3.17 kB
| # Sentinel-AI reverse proxy example (nginx) | |
| # | |
| # Terminates TLS, forwards to uvicorn on 127.0.0.1:8000, adds a second layer of | |
| # rate limiting, and enforces an upload cap. Replace the certificate paths and | |
| # domain before use. | |
| # | |
| # Backend: | |
| # cd backend | |
| # python -m uvicorn main:app --host 127.0.0.1 --port 8000 | |
| # | |
| # Then set in .env: | |
| # SENTINEL_API_KEY=<demo access token> | |
| # CORS_ORIGINS=https://sentinel.example.com | |
| # TRUST_PROXY_HEADERS=1 | |
| limit_req_zone $binary_remote_addr zone=sentinel_api:10m rate=10r/s; | |
| upstream sentinel_backend { | |
| server 127.0.0.1:8000; | |
| keepalive 32; | |
| } | |
| # Redirect HTTP to HTTPS. | |
| server { | |
| listen 80; | |
| listen [::]:80; | |
| server_name sentinel.example.com; | |
| location /.well-known/acme-challenge/ { | |
| root /var/www/certbot; | |
| } | |
| location / { | |
| return 301 https://$host$request_uri; | |
| } | |
| } | |
| server { | |
| listen 443 ssl; | |
| listen [::]:443 ssl; | |
| http2 on; | |
| server_name sentinel.example.com; | |
| ssl_certificate /etc/letsencrypt/live/sentinel.example.com/fullchain.pem; | |
| ssl_certificate_key /etc/letsencrypt/live/sentinel.example.com/privkey.pem; | |
| ssl_protocols TLSv1.2 TLSv1.3; | |
| ssl_prefer_server_ciphers off; | |
| ssl_session_cache shared:SSL:10m; | |
| ssl_session_timeout 1d; | |
| # Upload cap must be a little larger than MAX_UPLOAD_BYTES (10 MiB default). | |
| client_max_body_size 12m; | |
| client_body_timeout 30s; | |
| add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; | |
| add_header X-Content-Type-Options "nosniff" always; | |
| add_header X-Frame-Options "DENY" always; | |
| add_header Referrer-Policy "no-referrer" always; | |
| # Optional: serve the built dashboard from the same origin. TanStack Start | |
| # may require its own server if you use SSR; a static build works with this | |
| # block. | |
| # root /var/www/sentinel/frontend/dist; | |
| # index index.html; | |
| # location / { | |
| # try_files $uri $uri/ /index.html; | |
| # } | |
| location /api/ { | |
| limit_req zone=sentinel_api burst=20 nodelay; | |
| proxy_pass http://sentinel_backend; | |
| 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_set_header Connection ""; | |
| proxy_connect_timeout 5s; | |
| proxy_send_timeout 90s; | |
| proxy_read_timeout 90s; | |
| } | |
| location = /health { | |
| proxy_pass http://sentinel_backend; | |
| proxy_http_version 1.1; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| access_log off; | |
| } | |
| location /docs { | |
| # Optional: protect the API docs behind the same token or an IP allow-list. | |
| # allow 10.0.0.0/8; | |
| # deny all; | |
| proxy_pass http://sentinel_backend; | |
| proxy_http_version 1.1; | |
| proxy_set_header Host $host; | |
| } | |
| location /redoc { | |
| proxy_pass http://sentinel_backend; | |
| proxy_http_version 1.1; | |
| proxy_set_header Host $host; | |
| } | |
| location / { | |
| return 404; | |
| } | |
| } | |