Skip to content

Instantly share code, notes, and snippets.

@RamsesMartinez
Forked from MauricioDinki/server
Created April 7, 2017 21:39
Show Gist options
  • Save RamsesMartinez/ff1872dfeb437d624d6d0fe4d9298c37 to your computer and use it in GitHub Desktop.
Save RamsesMartinez/ff1872dfeb437d624d6d0fe4d9298c37 to your computer and use it in GitHub Desktop.
nginx server
upstream app_server {
server 127.0.0.1:9000 fail_timeout=0;
}
server {
listen 80;
server_name <server name>;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
ssl on;
ssl_certificate <path to .cer file>;
ssl_certificate_key <path to .key file>;
ssl_verify_depth <verify depth>;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 4G;
server_name <server name>;
keepalive_timeout 5;
# Your Django project's media files - amend as required
location /media {
alias <your media url>;
}
# your Django project's static files - amend as required
location /static {
alias <your static url>;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment