-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
33 lines (29 loc) · 1.16 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Upstream server pool
upstream app {
# Gunicorn is listening on this Unix socket
server unix:/app/app.sock;
}
# Server configuration
server {
# Listen on port 80 (HTTP)
listen 80 default_server;
server_name localhost; # Adjust if you have a specific server name
# Security headers
server_tokens off; # Don't show the Nginx version number
add_header X-Frame-Options "SAMEORIGIN"; # Protect against clickjacking
add_header X-Content-Type-Options "nosniff"; # Prevent MIME-sniffing
add_header X-XSS-Protection "1; mode=block"; # XSS filter protection
add_header Content-Security-Policy "default-src 'self'"; # Content security policy
# Charset setting
charset utf-8;
# Location block for routing requests
location / {
proxy_pass http://app; # Forward requests to the Gunicorn upstream
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_read_timeout 1000; # Adjust timeout as needed
client_max_body_size 30m; # Max upload size
}
}