Skip to content

Instantly share code, notes, and snippets.

@sharifulin
Created April 12, 2011 10:05
Show Gist options
  • Save sharifulin/915276 to your computer and use it in GitHub Desktop.
Save sharifulin/915276 to your computer and use it in GitHub Desktop.
nginx.conf
log_format view
'$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" [$request_time]';
server {
server_name www.site.com;
access_log off;
charset utf-8;
expires -1;
root /tk/www/site.com/data;
# error
error_page 403 404 /404.html;
error_page 500 502 503 504 512 /500.html;
location ~ /(403|404|500).html { #/
internal;
root /tk/www/site.com/data/e;
}
proxy_intercept_errors on;
proxy_ignore_client_abort on;
recursive_error_pages on;
# mojo static
location ~* ^/(amelia\.png|favicon\.ico|mojolicious-.*|css/prettify-mojo\.css|js/jquery\.js|js/prettify\.js)$ {
expires 14d;
proxy_pass http://127.0.0.1:3000;
}
# static
location ~* (^/test/|^/test/test/|\.test\.xml|opensearch.\.xml|crossdomain\.xml|\.(htm|html|xsl|xslt|js|css|ico|jpg|jpeg|gif|png|bmp|tar|tgz|gz|rar|bz2|zip|doc|rtf|pdf|ppt|txt|swf|flv|air|wav))$ {
expires 14d;
}
location / {
access_log /tk/www/site.com/log/nginx.log view;
proxy_pass http://127.0.0.1:3000;
proxy_set_header X-Real-IP $remote_addr;
}
# upgrading
# location / {
# rewrite .* /e/200.html break;
# }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment