Skip to content

Instantly share code, notes, and snippets.

@danielamorais
Created August 16, 2016 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielamorais/66746179fbbe039748b33df721f5a6bc to your computer and use it in GitHub Desktop.
Save danielamorais/66746179fbbe039748b33df721f5a6bc to your computer and use it in GitHub Desktop.
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
server_names_hash_bucket_size 64;
upstream test_server {
server unix:/var/www/test/run/gunicorn.sock fail_timeout=10s;
}
server {
listen 80;
server_name ec2-#-#-#-#.sa-east-1.compute.amazonaws.com;
client_max_body_size 4G;
access_log /var/www/test/logs/nginx-access.log;
error_log /var/www/test/logs/nginx-error.log warn;
location /static/ {
autoindex on;
alias /var/www/test/my-example/static/;
include /etc/nginx/mime.types;
}
location /media/ {
autoindex on;
alias /var/www/test/my-example/media/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://test_server;
break;
}
}
#For favicon
location /favicon.ico {
alias /var/www/test/test/static/img/favicon.ico;
}
#For robots.txt
location /robots.txt {
alias /var/www/test/test/static/robots.txt ;
}
# Error pages
error_page 500 502 503 504 /500.html;
location = /500.html {
root /var/www/test/my-example/static/;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment