Created
July 15, 2012 11:28
-
-
Save tvjames/3116339 to your computer and use it in GitHub Desktop.
templates/apps/nginx.conf
This file contains hidden or 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
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