Created
February 2, 2016 09:08
-
-
Save hqingyi/cea62724883a4405c143 to your computer and use it in GitHub Desktop.
nginx config
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 { | |
listen 80; | |
server_name example.me; | |
access_log /var/log/example/nginx-access.log; | |
error_log /var/log/example/nginx-error.log; | |
location /static/ { | |
alias /home/django/gaokao/static/; | |
if ( $uri ~* \.(png|jpe?g|gif|ico|ttf)$ ){ | |
expires 30d; | |
} | |
} | |
location / { | |
# checks for static file, if not found proxy to app | |
try_files $uri @proxy_to_app; | |
} | |
location @proxy_to_app { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://127.0.0.1:8888; | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
location ~ /\.ht { | |
deny all; | |
} | |
location ~ /\.git { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment