nginx-1.7.3 インストール

■nginx-1.7.3が、7月8日にリリースがされたので最新版をインストールしてみました。

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

■configure (/usr/local/src/nginx-1.7.3 )
./configure –prefix=/usr/local/nginx-1.7.3 \
–sbin-path=/usr/local/sbin/nginx \
–with-openssl=/usr/local/src/openssl-1.0.1g \
–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/ngx_small_light \
–add-module=/usr/local/src/nginx/ngx_cache_purge-2.1 \
–add-module=/usr/local/src/nginx/nginx-rtmp-module-master

■configure の not found を確認
hecking for OS
+ Linux 2.6.32-431.5.1.el6.x86_64 x86_64
checking for C compiler … found
+ using GNU C compiler
+ gcc version: 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
checking for gcc -pipe switch … found
checking for –with-ld-opt=” -Wl,-E” … found
checking for gcc builtin atomic operations … found
checking for C99 variadic macros … found
checking for gcc variadic macros … found
checking for unistd.h … found
checking for inttypes.h … found
checking for limits.h … found
checking for sys/filio.h … not found
checking for sys/param.h … found
checking for sys/mount.h … found
checking for sys/statvfs.h … found
checking for crypt.h … found
checking for Linux specific features
checking for epoll … found
checking for EPOLLRDHUP … found
checking for O_PATH … not found
checking for sendfile() … found
checking for sendfile64() … found
checking for sys/prctl.h … found
checking for prctl(PR_SET_DUMPABLE) … found
checking for sched_setaffinity() … found
checking for crypt_r() … found
checking for sys/vfs.h … found
checking for poll() … found
checking for /dev/poll … not found
checking for kqueue … not found
checking for crypt() … not found
checking for crypt() in libcrypt … found
checking for F_READAHEAD … not found
checking for posix_fadvise() … found
checking for O_DIRECT … found
checking for F_NOCACHE … not found
checking for directio() … not found
checking for statfs() … found
checking for statvfs() … found
checking for dlopen() … not found
checking for dlopen() in libdl … found
checking for sched_yield() … found
checking for SO_SETFIB … not found
checking for SO_ACCEPTFILTER … not found
checking for TCP_DEFER_ACCEPT … found
checking for TCP_KEEPIDLE … found
checking for TCP_FASTOPEN … not found
checking for TCP_INFO … found
checking for accept4() … found
checking for kqueue AIO support … not found
checking for Linux AIO support … found
checking for int size … 4 bytes
checking for long size … 8 bytes
checking for long long size … 8 bytes
checking for void * size … 8 bytes
checking for uint64_t … found
checking for sig_atomic_t … found
checking for sig_atomic_t size … 4 bytes
checking for socklen_t … found
checking for in_addr_t … found
checking for in_port_t … found
checking for rlim_t … found
checking for uintptr_t … uintptr_t found
checking for system byte ordering … little endian
checking for size_t size … 8 bytes
checking for off_t size … 8 bytes
checking for time_t size … 8 bytes
checking for AF_INET6 … found
checking for setproctitle() … not found
checking for pread() … found
checking for pwrite() … found
checking for sys_nerr … found
checking for localtime_r() … found
checking for posix_memalign() … found
checking for memalign() … found
checking for mmap(MAP_ANON|MAP_SHARED) … found
checking for mmap(“/dev/zero”, MAP_SHARED) … found
checking for System V shared memory … found
checking for POSIX semaphores … not found
checking for POSIX semaphores in libpthread … found
checking for struct msghdr.msg_control … found
checking for ioctl(FIONBIO) … found
checking for struct tm.tm_gmtoff … found
checking for struct dirent.d_namlen … not found
checking for struct dirent.d_type … found
checking for sysconf(_SC_NPROCESSORS_ONLN) … found
checking for openat(), fstatat() … found
checking for getaddrinfo() … found
configuring additional modules
adding module in /usr/local/src/nginx/ngx_small_light
checking for ngx_small_light dependencies … found
+ ngx_http_small_light was configured
adding module in /usr/local/src/nginx/ngx_cache_purge-2.1
+ ngx_http_cache_purge_module was configured
adding module in /usr/local/src/nginx/nginx-rtmp-module-master
+ ngx_rtmp_module was configured
checking for PCRE library … found
checking for PCRE JIT support … not found
checking for zlib library … found
checking for libxslt … found
checking for libexslt … found
checking for perl
+ perl version: v5.10.1 (*) built for x86_64-linux-thread-multi
+ perl interpreter multiplicity found
creating objs/Makefile

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

nginx path prefix: “/usr/local/nginx-1.7.3″
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

■設定ファイルが問題ないかどうかを確認する。
[root@ecoya nginx-1.5.12]# /usr/local/sbin/nginx -t
ginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

[root@ecoya nginx-1.5.12]# ldd /usr/local/sbin/nginx
linux-vdso.so.1 => (0x00007fff983ff000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb47f33e000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fb47f106000)
libMagickWand.so.2 => /usr/lib64/libMagickWand.so.2 (0x00007fb47edfb000)
libMagickCore.so.2 => /usr/lib64/libMagickCore.so.2 (0x00007fb47e9c3000)
libImlib2.so.1 => /usr/lib64/libImlib2.so.1 (0x00007fb47e758000)
libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00007fb47e4bb000)
libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007fb47e17e000)
libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007fb47df6a000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fb47dd66000)
libm.so.6 => /lib64/libm.so.6 (0x00007fb47dae2000)
libXpm.so.4 => /usr/lib64/libXpm.so.4 (0x00007fb47d8d0000)
libjpeg.so.62 => /usr/lib64/libjpeg.so.62 (0x00007fb47d680000)
libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00007fb47d44a000)
libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x00007fb47d223000)
libz.so.1 => /lib64/libz.so.1 (0x00007fb47d00d000)
libgd.so.2 => /usr/lib64/libgd.so.2 (0x00007fb47cdc6000)
libpcre.so.0 => /lib64/libpcre.so.0 (0x00007fb47cb99000)
libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007fb47c847000)
libxslt.so.1 => /usr/lib64/libxslt.so.1 (0x00007fb47c60a000)
libexslt.so.0 => /usr/lib64/libexslt.so.0 (0x00007fb47c3f5000)
libperl.so => /usr/lib64/perl5/CORE/libperl.so (0x00007fb47c08a000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fb47be70000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x00007fb47bc56000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007fb47ba53000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb47b6bf000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb47f565000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007fb47b447000)
liblcms.so.1 => /usr/lib64/liblcms.so.1 (0x00007fb47b20e000)
libtiff.so.3 => /usr/lib64/libtiff.so.3 (0x00007fb47afaa000)
libXt.so.6 => /usr/lib64/libXt.so.6 (0x00007fb47ad44000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fb47ab33000)
libgomp.so.1 => /usr/lib64/libgomp.so.1 (0x00007fb47a926000)
libltdl.so.7 => /usr/lib64/libltdl.so.7 (0x00007fb47a71c000)
libSM.so.6 => /usr/lib64/libSM.so.6 (0x00007fb47a514000)
libICE.so.6 => /usr/lib64/libICE.so.6 (0x00007fb47a2f8000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb47a0e1000)
libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007fb479ec3000)
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007fb479c9a000)
libgcrypt.so.11 => /lib64/libgcrypt.so.11 (0x00007fb479a25000)
libgpg-error.so.0 => /lib64/libgpg-error.so.0 (0x00007fb479820000)
librt.so.1 => /lib64/librt.so.1 (0x00007fb479618000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fb479413000)
libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007fb479210000)

[root@ecoya nginx-1.5.12]# find / -name libpcre.so.1
/usr/local/src/nginx/pcre/pcre-8.34/.libs/libpcre.so.1
/usr/local/lib/libpcre.so.1

[root@ecoya nginx-1.5.12]# cp -p /usr/local/lib/libpcre.so.1 /lib64

エラー内容 nginx: [emerg] mkdir() “/var/lib/nginx/tmp/client_body” failed (2: No such file or directory)
   mkdir /var/lib/nginx
mkdir /var/lib/nginx/tmp
chown -R ngix:nginx /var/lib/nginx
   
–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 \

/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

■ビルドが全て終わったらシンボリックリンクを貼っておきます
   ln -s /usr/local/nginx-1.7.3 /usr/local/nginx

PHP 5.4.26 に EACCELERATOR V1.0-DEV をインストール

WEBページ(WordPress)を高速にするため、PHP 5.4.26に eAccelerator v1.0-dev モジュールをコンパイルで追加しました。2台構成なので各インストールしました。

>サービスストップ
# service php-fpm stop

>PHP5.4に対応しているソースをダウンロード
# wget https://lnamp-web-server.googlecode.com/files/eaccelerator-eaccelerator-42067ac.tar.gz

>解凍
# tar -xvf eaccelerator-eaccelerator-42067ac.tar.gz

>移動
# cd eaccelerator-eaccelerator-42067ac

>ビルドツールの確認
# phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525

>which php-configのPath確認
# which php-config
/usr/bin/php-config

>eacceleratorのconfigure
# ./configure –enable-eaccelerator=shared –with-php-config=/usr/bin/php-config -with-eaccelerator-userid=nginx
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /bin/grep -E
checking for a sed that does not truncate output… /bin/sed
checking for cc… cc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether cc accepts -g… yes
checking for cc option to accept ISO C89… none needed
checking how to run the C preprocessor… cc -E
checking for icc… no
checking for suncc… no
checking whether cc understands -c and -o together… yes
checking for system library directory… lib
checking if compiler supports -R… no
checking if compiler supports -Wl,-rpath,… yes
checking build system type… x86_64-unknown-linux-gnu
checking host system type… x86_64-unknown-linux-gnu
checking target system type… x86_64-unknown-linux-gnu
checking for PHP prefix… /usr
checking for PHP includes… -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory… /usr/lib64/php/modules
checking for PHP installed headers prefix… /usr/include/php
checking if debug is enabled… no
checking if zts is enabled… no
checking for re2c… no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk… gawk
checking whether to enable eaccelerator support… yes, shared
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking for unistd.h… (cached) yes
checking limits.h usability… yes
checking limits.h presence… yes
checking for limits.h… yes
checking sys/param.h usability… yes
checking sys/param.h presence… yes
checking for sys/param.h… yes
checking sched.h usability… yes
checking sched.h presence… yes
checking for sched.h… yes
checking mandatory system headers… yes
checking whether union semun is defined in sys/sem.h… no
checking for sysvipc shared memory support… yes
checking for mmap shared memory support… yes
checking for mmap on /dev/zero shared memory support… yes
checking for anonymous mmap shared memory support… yes
checking for posix mmap shared memory support… no
checking for best shared memory type… sysvipc
checking for spinlock semaphores support… yes
checking for pthread semaphores support… yes
checking for posix semaphores support… no
checking for sysvipc semaphores support… no
checking for fcntl semaphores support… yes
checking for flock semaphores support… yes
checking for best semaphores type… spinlock
checking for a sed that does not truncate output… (cached) /bin/sed
checking for fgrep… /bin/grep -F
checking for ld used by cc… /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld… yes
checking for BSD- or MS-compatible name lister (nm)… /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface… BSD nm
checking whether ln -s works… yes
checking the maximum length of command line arguments… 1966080
checking whether the shell understands some XSI constructs… yes
checking whether the shell understands “+=”… yes
checking for /usr/bin/ld option to reload object files… -r
checking for objdump… objdump
checking how to recognize dependent libraries… pass_all
checking for ar… ar
checking for strip… strip
checking for ranlib… ranlib
checking command to parse /usr/bin/nm -B output from cc object… ok
checking for dlfcn.h… yes
checking for objdir… .libs
checking if cc supports -fno-rtti -fno-exceptions… no
checking for cc option to produce PIC… -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works… yes
checking if cc static flag -static works… no
checking if cc supports -c -o file.o… yes
checking if cc supports -c -o file.o… (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries… yes
checking whether -lc should be explicitly linked in… no
checking dynamic linker characteristics… GNU/Linux ld.so
checking how to hardcode library paths into programs… immediate
checking whether stripping libraries is possible… yes
checking if libtool supports shared libraries… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands

>eacceleratorのmake
# make

・・・・省略・・・・

libtool: install: cp ./.libs/eaccelerator.so /usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac/modules/eaccelerator.so
libtool: install: cp ./.libs/eaccelerator.lai /usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac/modules/eaccelerator.la
libtool: finish: PATH=”/root/.rbenv/bin:/root/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/sbin” ldconfig -n /usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac/modules
———————————————————————-
Libraries have been installed in:
/usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR’
flag during linking and do at least one of the following:
– add LIBDIR to the `LD_LIBRARY_PATH’ environment variable
during execution
– add LIBDIR to the `LD_RUN_PATH’ environment variable
during linking
– use the `-Wl,-rpath -Wl,LIBDIR’ linker flag
– have your system administrator add LIBDIR to `/etc/ld.so.conf’

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
———————————————————————-

Build complete.
Don’t forget to run ‘make test’.

>eacceleratorのmake test
# make test

Build complete.
Don’t forget to run ‘make test’.
=====================================================================
PHP : /usr/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.4.26
ZEND_VERSION: 2.4.0
PHP_OS : Linux – Linux websample.jp 2.6.32-431.5.1.el6.x86_64 #1 SMP Wed Feb 12 00:41:43 UTC 2014 x86_64
INI actual : /usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac/tmp-php.ini
More .INIs :
CWD : /usr/local/src/php-eaccelerator/eaccelerator-eaccelerator-42067ac
Extra dirs :
VALGRIND : Not used
=====================================================================
TIME START 2014-03-10 19:13:05
=====================================================================
No tests were run.

>eacceleratorのmake install
# make install
Installing shared extensions: /usr/lib64/php/modules/

+——————————————————-+
| !!! Attention !!! |
| |
| For disk cache users (using eaccelerator.shm_only=0): |
| |
| Please remember to empty your eAccelerator disk cache |
| when upgrading, otherwise things will break! |
+——————————————————-+
>/etc/php.ini の最後に以下を追記
[eaccelerator]
zend_extension=”/usr/lib64/php/modules/eaccelerator.so”
eaccelerator.shm_size = “128″
eaccelerator.cache_dir = “/var/cache/php-eaccelerator”
eaccelerator.enable = “1″
eaccelerator.optimizer = “1″
eaccelerator.check_mtime = “1″
eaccelerator.debug = “0″
eaccelerator.filter = “”
eaccelerator.shm_max = “0″
eaccelerator.shm_ttl = “0″
eaccelerator.shm_prune_period = “0″
eaccelerator.shm_only = “0″
eaccelerator.compress = “1″
eaccelerator.compress_level = “9″
eaccelerator.keys = “shm_and_disk”
eaccelerator.sessions = “shm_and_disk”
eaccelerator.content = “shm_and_disk”

>php-fpm の起動
# service php-fpm start

※確認1
# php -v
PHP 5.4.26 (cli) (built: Mar 5 2014 16:04:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with eAccelerator v1.0-dev, Copyright (c) 2004-2012 eAccelerator, by eAccelerator

※確認2
# php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
eAccelerator   ←←←←←←←←←←
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
libxml
mbstring
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
recode
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]
eAccelerator

※ギャラリー(写真)ページが遅かったが、1度キャシュされた後は、体感で感じるほど高速になりました。

FCGIWRAP SPAWN-FCGI インストール

nginxのCGIとしてperlを使えるようにするには、fcgiwrap+spawn-fcgiを使う方法と、fcgi-perl+fastcgi-wrapper.plを使う方法があります。以下は、fcgiwrap+spawn-fcgiのインストールです。

 

>fcgi-devel のインストール
yum –enablerepo=epel install fcgi-devel

>fcgiwrapのダウンロード
# cd /usr/local/src/fcgiwrap
# wget -O fcgiwrap.tar.gz http://github.com/gnosek/fcgiwrap/tarball/master

>解凍
# tar xvf fcgiwrap.tar.gz

>移動
# cd gnosek-fcgiwrap-66e7b7d

>ビルドツールの確認
# autoreconf -i
# ./configure
# make
# make install

>spawn-fcgi のインストール
# yum –enablerepo=epel install spawn-fcgi

>/etc/sysconfig/spawn-fcgi ファイルの最後に1行追加します。
vi /etc/sysconfig/spawn-fcgi
以下1行追加
OPTIONS=”-u nginx -g nginx -a 127.0.0.1 -p 9000 -P /var/run/spawn-fcgi.pid — /usr/local/sbin/fcgiwrap”

>nginxの設定ファイル
cd /etc/nginx/conf.d
vi default.conf
# server セクション内の適当な位置に設定を追記
location ~ \.pl|cgi$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}

>nginx再起動
# service nginx restart
>spawn-fcgiを自動起動の設定
# chkconfig spawn-fcgi on
>spawn-fcgiの起動
# service spawn-fcgi start

>perlでCGIを使う場合
# yum install perl-CGI
# yum –enablerepo=epel install perl-FCGI
※スクリプト内で「use CGI;」が利用可能

>perlのシンボリックリンク
# ln -s /usr/bin/perl /usr/local/bin/perl
ファイル1行目の記載が「#!/usr/bin/perl」、「#!/usr/local/bin/perl」どちらも動作可能

ap.tar.gz

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;    <- 追加