Skip to content

Instantly share code, notes, and snippets.

@lajunta
Created October 23, 2013 06:55
Show Gist options
  • Save lajunta/7113754 to your computer and use it in GitHub Desktop.
Save lajunta/7113754 to your computer and use it in GitHub Desktop.
upstream dljyunicorn {
#server unix:/tmp/dljy.sock fail_timeout=0;
server localhost:9999;
}
server {
listen 80;
charset utf-8;
server_name dl.lwqzx.net;
add_header Cache-Control public;
access_log /var/log/nginx/access_dljy.log main;
error_log /var/log/nginx/error_dljy.log;
index index.html index.htm;
root /data/sites/dljy/public;
## Only requests to our Host are allowed
# if ($host !~ ^(mydomain.com|www.mydomain.com)$ ) {
# if ($host !~ ^(localhost|dl.sdedu.net)$ ) {
# return 444;
# }
## Only allow these request methods
# if ($request_method !~ ^(GET|HEAD|POST)$ ) {
# return 444;
# }
#location ~* .(js|css|png|jpg|jpeg|gif|ico)$ { expires 1d;}
## Only allow these full URI paths relative to document root. If you only want
## to reference the filename use $request_filename instead of $request_uri
# location / {
# if ($request_uri ~* (^\/|\.html|\.jpg|\.pl|\.png|\.css|\.ico|robots\.txt)$ ) {
# break;
# }
# return 444;
# }
recursive_error_pages on;
if (-f $document_root/maintenance.html) { return 503; }
error_page 404 /404.html;
error_page 500 502 504 /500.html;
error_page 503 @503;
location @503 {
error_page 405 = /maintenance.html;
# Serve static assets if found
if (-f $request_filename) { break; }
rewrite ^(.*)$ /maintenance.html break;
}
location /pe/ {
# proxy_pass http://localhost:8088/pe/;
proxy_pass http://172.16.1.211:8088/pe/;
}
location /festival/ {
proxy_pass http://172.16.1.12:9191/festival/;
}
location / {
if ($request_filename ~* ".(ico|css|js|gif|jpg|jpeg|png|swf)$") { expires 10m; break; }
proxy_pass http://dljyunicorn;
#proxy_pass http://localhost:8888/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment