Nginx-1.4.1にアップデート

先日の記事(nginxにSPDYパッチあててみた)でnginxのSPDY対応をすませた訳ですが、 パッチをあてずとも正式にSPDY対応したnginx-1.4が出ちゃったのでアップデートします。
あとwebsocketのリバースプロキシにも対応したそうですね。

環境

  • CentOS6.3 x86_64

Install

手順はパッチをあてる以外、前回とほぼ同じです。
しっかりバックアップを取ってから作業します。
 
まずは現在のconfigureオプションの確認から。

1
2
3
4
5
# nginx -V
nginx version: nginx/1.3.14
built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx/ --sbin-path=/usr/local/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-file-aio --with-cc-opt='-O2 -g' --with-openssl=/usr/local/src/spdy/openssl-1.0.1e --with-http_spdy_module

これを元にビルドします。
SPDYは前回のビルド時に有効にしていたのでもうありますね。
--with-openssl--sbin-pathのpathだけ書き換えてビルドします。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
mkdir /usr/local/src/nginx-1.4.1
cd /usr/local/src/nginx-1.4.1
wget http://nginx.org/download/nginx-1.4.1.tar.gz
wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz
tar xvzf nginx-1.4.1.tar.gz
tar xvzf openssl-1.0.1e.tar.gz
cd nginx-1.4.1

./configure \
--prefix=/etc/nginx/ \
--sbin-path=/usr/local/sbin/nginx-1.4.1 \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx --group=nginx --with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-file-aio \
--with-cc-opt='-O2 -g' \
--with-openssl=/usr/local/src/nginx-1.4.1/openssl-1.0.1e \
--with-http_spdy_module


Configuration summary
  + using system PCRE library
  + using OpenSSL library: /usr/local/src/nginx-1.4.1/openssl-1.0.1e
  + md5: using OpenSSL library
  + sha1: using OpenSSL library
  + using system zlib library

  nginx path prefix: "/etc/nginx/"
  nginx binary file: "/usr/local/sbin/nginx-1.4.1"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/var/run/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "/var/cache/nginx/client_temp"
  nginx http proxy temporary files: "/var/cache/nginx/proxy_temp"
  nginx http fastcgi temporary files: "/var/cache/nginx/fastcgi_temp"
  nginx http uwsgi temporary files: "/var/cache/nginx/uwsgi_temp"
  nginx http scgi temporary files: "/var/cache/nginx/scgi_temp"

make
sudo make install

確認 & restart

1
2
3
4
5
# /usr/local/sbin/nginx-1.4.1 -V
nginx version: nginx/1.4.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx/ --sbin-path=/usr/local/sbin/nginx-1.4.1 --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-file-aio --with-cc-opt='-O2 -g' --with-openssl=/usr/local/src/nginx-1.4.1/openssl-1.0.1e --with-http_spdy_module

問題なし!
あとは/usr/local/sbin/nginxをリネームしたりへシンボリックリンク張ったりしていい感じにします。
最後に再起動して完了!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# which nginx
/usr/local/sbin/nginx

# mv /usr/local/sbin/nginx /usr/local/sbin/nginx-1.3.14
# ln -s /usr/local/sbin/nginx-1.4.1 /usr/local/sbin/nginx
# nginx -v
nginx version: nginx/1.4.1

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

# service nginx restart
nginx を停止中:                                            [  OK  ]
nginx を起動中:                                            [  OK  ]

まとめ

  • nginxって現在のconfigureオプションが確認できるからソースからインストールするときも安心(´ω`)
  • よってyumでインストールしたnginxからのアップデートも簡単!
  • 結果幸せです。

Comments