Skip to content

Instantly share code, notes, and snippets.

@tvjames
Created July 15, 2012 11:28
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 tvjames/3116339 to your computer and use it in GitHub Desktop.
Save tvjames/3116339 to your computer and use it in GitHub Desktop.
templates/apps/nginx.conf
upstream %(appname)s {
%(appname_upstream)s}
server {
listen 80;
listen [::]:80;
root %(app_folder_static)s;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name %(appname_internal)s %(appname_cname)s;
access_log %(app_folder_logs)s/%(appname)s-access.log;
error_log %(app_folder_logs)s/%(appname)s-error.log;
location / {
try_files $uri @upstream;
}
error_page 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
location @upstream {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://%(appname)s;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment