Skip to content

Instantly share code, notes, and snippets.

@timbuchwaldt
Created July 13, 2009 17:14
Show Gist options
  • Save timbuchwaldt/146285 to your computer and use it in GitHub Desktop.
Save timbuchwaldt/146285 to your computer and use it in GitHub Desktop.
http
{
keepalive_timeout 1800;
ncache_max_size 24;
proxy_buffering off;
ncache_dir /data1/ngx_cache/ 128 64;
ncache_dir /data2/ngx_cache/ 128 64;
ncache_dir /data3/ngx_cache/ 128 64;
ncache_dir /data4/ngx_cache/ 128 64;
ncache_ignore_client_no_cache on;
upstream backend
{
server 78.47.93.49;
}
sendfile on;
send_timeout 90;
client_header_timeout 120;
tcp_nodelay on;
include "mime.types";
server
{
access_log off;
server_name .piraten.21studios.de;
listen piraten.21studios.de:8080;
set $xvia "piraten.21studios.de";
set $proxy_add_agent "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; NginxCache)";
#access_log logs/blog.sina.com.cn-access_log main;
location /
{
if ($request_method ~ "PURGE")
{
rewrite (.*) /PURGE$1 last;
}
if ($request_uri = /)
{
rewrite ^/$ /lm/index.html last;
}
ncache_http_cache;
error_page 404 = /fetch$request_uri;
add_header Sina-Cache $xvia;
}
location /ncache_state
{
ncache_state;
}
location /fetch
{
internal;
proxy_pass http://backend;
add_header Sina-Cache $xvia;
proxy_hide_header User-Agent;
proxy_set_header User-Agent $proxy_add_agent;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
sub_filter '<a href="/datenschutzerklaerung" rel="nofollow" >Datenschutzerklärung</a>' '<a href="/datenschutzerklaerung" rel="nofollow" >Datenschutzerklärung</a> | <em> Cached by 21Studios.de</em> - <a href="http://www.piratenpartei.de">Direktzugriff</a>';
sub_filter_once off;
}
location /PURGE/
{
#access_log logs/purge.blog.sina.com.cn-access_log main;
#internal;
allow all;
#deny all;
ncache_purge;
}
location /nginx_status {
# copied from http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/
stub_status on;
access_log off;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment