升級 Nginx 到 1.0.6


因為這一個星期裡面出現了很多 0day 或者關注的漏洞.
先是 Nginx 的再來就是 Apache 的 Range 洞導至 Loading 過高而拒絕服務
所以在昨天晚上回到家後就將 Nginx 升級到剛發佈的新版本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 建立新的目錄來存放下載檔
cd ~/ && mkdir 20110830 && cd 20110830

# 下載整個 Source Package (雖然用 FreeBSD 但自己 Port 只用來裝 lib/tools)
# 如果是 Linux 可改用 wget 的指令
# 之後解壓和切進目錄裡面
fetch http://nginx.org/download/nginx-1.0.6.tar.gz
tar zxvf nginx-1.0.6.tar.gz
cd nginx-1.0.6

# 編譯出執行檔,至於參數可以用 --help 查看.不作解釋了
./configure --prefix=/usr/local/nginx --user=[你的執行用戶] --group=[你的執行用戶組] --with-select_module --with-poll_module --with-file-aio --with-http_ssl_module --with-http_gzip_static_module --with-http_secure_link_module --with-http_sub_module --with-http_stub_status_module --with-http_secure_link_module --with-http_perl_module
make
make install

# 殺掉 Nginx 進程再重新執行
killall nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

# 另外如果容怕內容會覆蓋可以先打包整個 nginx (其實在重新編譯後,原檔案會被命名為 *.old)
# 清空 logs 之後打包
echo "" > /usr/local/nginx/logs/access.log
echo "" > /usr/local/nginx/logs/error.log
tar zcvf nginx-20110830.tar.gz /usr/local/nginx