歡迎您光臨本站 註冊首頁

升級nginx到1.2.0

←手機掃碼閱讀     火星人 @ 2014-03-08 , reply:0

首先下載最新源碼文件 nginx-1.2.0.tar.gz
解壓 tar -zxvf nginx-1.2.0.tar.gz 同目錄下產生同名文件夾
cd nginx-1.2.0.tar.gz

察看原來的配置 /usr/local/nginx/sbin/nginx -V 注意是大寫的V
nginx version: nginx/0.7.6.x
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
TLS SNI support disabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module

拷貝你的紅色字體的安裝配置參數
安裝配置:
cd nginx-1.2.0
# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module

中途提示缺少pcre配置,圖省事,直接yum安裝
yum -y install pcre-devel
yum -y install pcre-devel openssl openssl-devel

然後make但是不要make install
編譯完,在objs目錄下有一個nginx執行文件,備份下原來老的nginx文件:
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
複製新文件
cp objs/nginx /usr/local/nginx/sbin/nginx
檢測一下是否正常讀取配置文件
/usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful


顯示沒有問題.

執行命令完成升級: make upgrade 會有如下輸出
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`
sleep 1
test -f /usr/local/nginx/logs/nginx.pid.oldbin
kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`

檢查版本是否已經更新:/usr/local/nginx/sbin/nginx -V


nginx version: nginx/1.2.0
TLS SNI support disabled
還有一行是你的編譯參數
至此,升級完成.

我在升級過程中make報錯
編譯時候出現錯誤提示:
objs/src/http/ngx_http_request.o: In function `ngx_http_ssl_servername':
ngx_http_request.c:(.text 0xba7): undefined reference to `SSL_get_servername'
ngx_http_request.c:(.text 0xc5b): undefined reference to `SSL_set_SSL_CTX'

原因是升級了openssl
解決辦法:
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-openssl=這裡執行openssl的源碼包的地址,不是安裝路徑


本文出自 「成長全記錄」 博客,請務必保留此出處http://lymrg.blog.51cto.com/1551327/863696

 

[火星人 ] 升級nginx到1.2.0已經有369次圍觀

http://coctec.com/docs/linux/show-post-45924.html