-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnginx.conf
41 lines (35 loc) · 1.37 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
34
35
36
37
38
39
40
41
# Sets the max number of simultaneous connections that can be opened by a worker process
events {
worker_connections 1024;
}
http {
# Enable gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
server {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
listen 80;
# Requests to /static/ are served directly from the /static/ directory
location /static/ {
alias /static/;
expires 7d;
}
# Configuration for serving media files
# location /media/ {
# alias /home/app/web/mediafiles/;
# }
# Handles all other requests
location / {
# Forward requests to Django application
proxy_pass http://django-web:8000;
# Pass important headers to Django for proper request handling
proxy_set_header Host $host; # Original host header
proxy_set_header X-Real-IP $remote_addr; # Client's real IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Chain of IP addresses
proxy_set_header X-Forwarded-Proto $scheme; # Original protocol (http/https)
}
}
}