nginxにetagモジュールを付ける方法

システム環境:
CentOS5.6_x64
Nginx 1.0.0

ダウンロードURL:
nginx: http://nginx.org/
Etag:https://nodeload.github.com/mikewest/nginx-static-etags/tarball/master

インストール:
1.Etagをダウンロード
ファイル名  mikewest-nginx-static-etags-25bfaf9.tar.gz
パス /root/soft/mikewest-nginx-static-etags-25bfaf9.tar.gz

2.nginxを再度コンパイルして、Etagをインストール
2.1 nginx -V
–user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module

2.2 コンパイル
cd /root/soft
tar zxvf mikewest-nginx-static-etags-25bfaf9.tar.gz
echo " >> /root/soft/ mikewest-nginx-static-etags-25bfaf9/ngx_http_static_etags_module.c

cd /root/soft/nginx1.0.0
./configure –user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module –add-module=/root/soft/mikewest-nginx-static-etags-25bfaf9
make //make install NG
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak //バックアップ
cp objs/nginx /usr/local/nginx/sbin/nginx.tmp //新しいnginxを変更
rm -rf /usr/local/nginx/sbin/nginx && mv /usr/local/nginx/sbin/nginx.tmp /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -t
kill -USR2 `cat /usr/local/nginx/logs/nginx.pid` //nginxが起動
kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin` //nginx -s reload

2.3 nginxを変更.
conflocation ~ .*/.(gif|jpg|jpeg|png|bmp|ico|rar|css|js|zip|xml|txt|flv|swf|mid|doc|cur|xls|pdf|txt|)$
{
FileETag on;
etag_format “%X%X";
expires 30d;
}

3.nginxが起動
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -s reload

Nginx

Posted by arkgame