Skip to content

Instantly share code, notes, and snippets.

@ajeebkp23
Last active January 21, 2024 14:09
Show Gist options
  • Save ajeebkp23/b63999b595075528fc118e147f37e848 to your computer and use it in GitHub Desktop.
Save ajeebkp23/b63999b595075528fc118e147f37e848 to your computer and use it in GitHub Desktop.
Nginx config sample for Django
server {
server_name example.com;
root /home/myuser/mydjangoproject/staticfiles/;
index index.html;
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 128;
# Proxy connections to the application servers
# app_servers
location /static {
autoindex off;
alias /home/myuser/mydjangoproject/staticfiles/;
}
location /media {
autoindex off;
alias /home/myuser/mydjangoproject/media/;
}
location / {
proxy_pass http://localhost:8000;
# proxy_redirect off;
# 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-Host $server_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment