Last active
January 21, 2024 14:09
-
-
Save ajeebkp23/b63999b595075528fc118e147f37e848 to your computer and use it in GitHub Desktop.
Nginx config sample for Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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