NGINX-1.5.12. コンパイル インストール手順

OpenSSL-1.0.1gへバージンアップに伴い、最新のNginx-1.5.12をインストールしました。

>ダウンロードしてインストール (/usr/local/src/nginx ←ダウンロード場所)
wget http://nginx.org/download/nginx-1.5.12.tar.gz
tar xvzf nginx-1.5.12.tar.gz

>コンフィグ configure (/usr/local/src/nginx-1.5.12 )
./configure –prefix=/usr/local/nginx-1.5.12 \
–sbin-path=/usr/local/sbin/nginx \
–with-openssl=/usr/local/src/openssl/openssl-1.0.1g \
–add-module=/usr/local/src/nginx-1.5.12/ngx_cache_purge-2.1 \
–conf-path=/etc/nginx/nginx.conf \
–error-log-path=/var/log/nginx/error.log \
–http-log-path=/var/log/nginx/access.log \
–http-client-body-temp-path=/var/lib/nginx/tmp/client_body \
–http-proxy-temp-path=/var/lib/nginx/tmp/proxy \
–http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi \
–http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi \
–http-scgi-temp-path=/var/lib/nginx/tmp/scgi \
–pid-path=/var/run/nginx.pid \
–lock-path=/var/lock/subsys/nginx \
–user=nginx \
–group=nginx \
–with-file-aio \
–with-ipv6 \
–with-pcre \
–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_degradation_module \
–with-http_stub_status_module \
–with-http_perl_module \
–with-http_xslt_module \
–with-mail \
–with-mail_ssl_module \
–with-http_spdy_module \
–with-cc-opt=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic’ \
–with-ld-opt=’ -Wl,-E’ \
–add-module=/usr/local/src/nginx-1.5.12/nginx-rtmp-module-master

>configureの確認
onfiguration summary
+ using system PCRE library
+ using OpenSSL library: /usr/local/src/openssl/openssl-1.0.1g
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library

nginx path prefix: “/usr/local/nginx-1.5.12″
nginx binary file: “/usr/local/sbin/nginx”
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/lib/nginx/tmp/client_body”
nginx http proxy temporary files: “/var/lib/nginx/tmp/proxy”
nginx http fastcgi temporary files: “/var/lib/nginx/tmp/fastcgi”
nginx http uwsgi temporary files: “/var/lib/nginx/tmp/uwsgi”
nginx http scgi temporary files: “/var/lib/nginx/tmp/scgi”

>make;make install

>chkconfig nginx on

>service nginx start

# ps -ef | grep nginx
ginx 27732 1 0 Apr20 ? 00:00:00 /usr/local/sbin/fcgiwrap
nginx 28262 28261 0 14:18 ? 00:00:00 php-fpm: pool www
nginx 28263 28261 0 14:18 ? 00:00:00 php-fpm: pool www
nginx 28264 28261 0 14:18 ? 00:00:00 php-fpm: pool www
nginx 28265 28261 0 14:18 ? 00:00:00 php-fpm: pool www
nginx 28266 28261 0 14:18 ? 00:00:00 php-fpm: pool www
root 28319 1 0 14:19 ? 00:00:00 nginx: master process /usr/local/sbin/nginx -c /etc/nginx/nginx.conf
nginx 28320 28319 0 14:19 ? 00:00:00 nginx: worker process
nginx 28321 28319 0 14:19 ? 00:00:00 nginx: worker process
nginx 28322 28319 0 14:19 ? 00:00:00 nginx: cache manager process

>補足1
./configure: のエラー1
checking for PCRE library … not found
checking for PCRE library in /usr/local/ … not found
checking for PCRE library in /usr/include/pcre/ … not found
checking for PCRE library in /usr/pkg/ … not found
checking for PCRE library in /opt/local/ … not found

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using –without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using –with-pcre= option.

PCRE のインストール
# cd /usr/local/src/
# mkdir pcre
# wget http://downloads.sourceforge.net/pcre/pcre-8.34.tar.bz2
# tar -jxvf pcre-8.34.tar.bz2
# cd pcre-8.34/
# ./configure
# make
# make install

>補足2
./configure: のエラー2
./configure: error: the HTTP XSLT module requires the libxml2/libxslt
libraries. You can either do not enable the module or install the libraries.

libxslt libxslt-devel ibxml2 libxml2-devel のインストール
# yum install libxslt libxslt-devel
# yum install ibxml2 libxml2-devel

>補足3
./configure: のエラー3
+ perl version: v5.10.1 (*) built for x86_64-linux-thread-multi
Can’t locate ExtUtils/Embed.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed–compilation aborted.

./configure: error: perl module ExtUtils::Embed is required

perl-ExtUtils-Embed のインストール
# yum install perl-ExtUtils-Embed

>補足4
/usr/local/sbin/nginx -t: のエラー1

# /usr/local/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] getpwnam(“nginx”) failed
nginx: configuration file /etc/nginx/nginx.conf test failed

NGINXユーザ、グループを作成
groupadd nginx
useradd -g nginx nginx
usermod -s /bin/false nginx( nginx 用のユーザをログイン禁止に設定)

>補足5
/usr/local/sbin/nginx -t: のエラー2

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] mkdir() “/var/lib/nginx/tmp/client_body” failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

/var/lib/nginx/tmpフォルダの作成
# mkdir /var/lib/nginx
# mkdir /var/lib/nginx/tmp
# chown -R nginx:nginx /var/lib/nginx

>補足6
/usr/local/sbin/nginx -t: のOK表示
# /usr/local/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

>補足7
Server Name Indication(SNI、サーバー ネーム インディケーション)によって名前ベースのバーチャルホストで
SSLが使えるとのこと。
#nginx -V
nginx version: nginx/1.5.12
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
TLS SNI support enabled
configure arguments: –prefix=/usr/local/nginx-1.5.12 –sbin-path=/usr/local/sbin/nginx –with-openssl=/usr/local/src/openssl/openssl-1.0.1g –add-module=/usr/local/src/nginx-1.5.12/ngx_cache_purge-2.1 –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –http-client-body-temp-path=/var/lib/nginx/tmp/client_body –http-proxy-temp-path=/var/lib/nginx/tmp/proxy –http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi –http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi –http-scgi-temp-path=/var/lib/nginx/tmp/scgi –pid-path=/var/run/nginx.pid –lock-path=/var/lock/subsys/nginx –user=nginx –group=nginx –with-file-aio –with-ipv6 –with-pcre –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_degradation_module –with-http_stub_status_module –with-http_perl_module –with-http_xslt_module –with-mail –with-mail_ssl_module –with-http_spdy_module –with-cc-opt=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic’ –with-ld-opt=’ -Wl,-E’ –add-module=/usr/local/src/nginx-1.5.12/nginx-rtmp-module-master

>補足8
/etc/nginx/mime.types ファイルに以下の追加が必要なくなった。
application/x-mpegURL m3u8; <- 追加 video/MP2T ts;    <- 追加

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>