1. 下载
1). nginx0.8.2.26
wget http://sysoev.ru/nginx/nginx-0.8.26.tar.gz
2).
nginx / cache_purge patch
wget http://labs.frickle.com/files/nginx-0.8.26-cache_purge-1.0.patch
2.解压 nginx
sudo tar -zxvf nginx-0.8.26.tar.gz
3. patch
cd nginx-0.8.26
sudo patch -p1 < ../nginx-0.8.26-cache_purge-1.0.patch
4. 编译
1). 添加configure.sh
#! /bin/bash
VERSION=0.8.26
NAME=nginx
./configure --prefix=/usr/local/$NAME --sbin-path=/usr/local/sbin/$NAME.$VERSION --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.8.x.pid --http-log-path=/var/log/nginx/8.x.access.log --error-log-path=/var/log/nginx/8.x.error.log --user=nginx --group=nginx --with-openssl=/usr/lib/ssl/ --with-http_stub_status_module --with-http_flv_module --with-http_sub_module
2). 修改configure 权限
sudo chmod 755 configure
3)sudo ./configure.sh
4)sudo make
5)sudo make install
5. nginx-test.conf
user www-data;
worker_processes 1;
error_log /data/nginx_log/8.26.error-test.log;
#master_process off;
#daemon off;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid /var/run/nginx-test.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
access_log /data/nginx_log/8.26.test-access.log;
gzip on;
proxy_temp_path /data/nginx-proxy-temp;
proxy_cache_path /data/nginx_cache/purge_test levels=1:2 keys_zone=purge_test:800m inactive=20d;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 83;
server_name etch2;
location /{
allow 192.168.1.0/16;
allow 127.0.0.1/32;
deny all;
charset utf-8;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 60;
proxy_buffer_size 16k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_cache purge_test;
proxy_cache_key test$request_uri;
proxy_cache_valid 200 302 30m;
proxy_cache_valid 301 1d;
proxy_cache_valid any 2m;
proxy_cache_min_uses 1;
proxy_cache_use_stale error timeout invalid_header http_500;
expires 12h; # will this put a stamp on the stream from the upstream which does not (yet)
proxy_pass http://localhost:8080;
}
location ~ /purge(/.*){
allow 192.168.0.0/16;
allow 127.0.0.1/32;
allow 222.66.142.229/32;
deny all;
# set $ppath test$1?$query_string;
# proxy_cache_purge purge_test $ppath;
proxy_cache_purge purge_test test$1$is_args$args;
}
}
}
(
posted on 2009-11-17 17:45
冰是没有未来的,因为它的永恒 阅读(497)
评论(0) 编辑 收藏 所属分类:
nginx