Install NGINX
빠르고 강력한 소련제 웹서버 NGINX. 영문 WIKI가 있긴하지만, 비영어권 사람이 개발한 티를 내듯 자세한 매뉴얼을 기대하긴 어렵다.
러시아에서 두번째로 방문자가 많은 www.Ramber.ru 라는 사이트에서 사용하기 위해 개발했다고 하니 포털서비스에 이용할만큼 성능이 뛰어나다는것을 간접적으로 느끼게 해준다.
실제로 필자는 이 웹서버는 현 시점에서 www.filenavi.com 이라는 사이트를 개발하면서 로드밸런싱용 프록시, 세션공유, 이미지서버 등 다양한 기능을 위해 웹서버가 아닌 다른 용도로써 사용한다.
다시한번 강조하지만, 제대로된 매뉴얼을 기대하기 어렵다. 아파치에 길들여져있다보니 각 설정의 이름이나 값들도 어색하기 짝이없다. 하지만, 도전해볼만한 가치가 있고, 그 성능또한 기대이상으로 내어주고 있기때문에 앞으로 여러가지 사이트들을 이 시스템과 아파치 기반 두가지로 구동하여 테스트해보고 일반 사용여부를 판단할 예정이다.
처음 NGINX 를 접하신 분들은 영문 WIKI사이트의 한글판인 http://wiki.codemongers.com/NginxKo 를 참조하도록 하자
또 강조하지만, 이 페이지는 다만 목차만 한글화 되어 있을 뿐이다. 편하게 각종 정보를 얻을 수 있다는 기대는 버리도록.
아래는 필자의 웹서버에 설치하기 위해 NGINX 의 configure 부분이며, 그 하단의 인용글은 모처에서 습득한 CentOS 상에서 쉽게 NGINX를 설치하기 위한 따라하기이다. 원본 URL이 기억나지 않아 아쉽다.
하지만, 따라하기 식이라 초보자들도 쉽게 설치하지 싶다.
(참고로 필자의 웹서버는 이 웹서버를 이미지서버와 캐싱서버 용도로 사용할것이라 PHP나 Perl 등의 옵션은 빠져있다. 참고로 fastcgi 와의 연동은 php-cgi와 lighttpd-fastcgi 를 yum 을 통해 설치해서 간단한 설정을 통해 쉽게 연동할 수 있다.)
./configure --sbin-path=/usr/sbin --with-http_realip_module --with-http_ssl_module \ --with-http_ssl_module --with-http_addition_module --with-http_sub_module \ --with-http_dav_module --with-http_stub_status_module --with-mail --with-mail_ssl_module \ --with-cc-opt="-I /usr/include/pcre" --pid-path=/var/run/nginx.pid \ --lock-path=/var/lock/subsys/nginx --conf-path=/etc/nginx/nginx.conf
Installing Nginx on CentOS 5 [root@rubyplus etc]# yum install pcre Loading "installonlyn" plugin Setting up Install Process Setting up repositories base 100% |=========================| 1.1 kB 00:00 updates 951 B 00:00 addons 100% |=========================| 951 B 00:00 extras 100% |=========================| 1.1 kB 00:00 Reading repository metadata in from local files Parsing package install arguments Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Downloading header for pcre to pack into transaction set. pcre-6.6-2.el5_1.7.i386.r 100% |=========================| 7.4 kB 00:00 ---> Package pcre.i386 0:6.6-2.el5_1.7 set to be updated --> Running transaction check Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Updating: pcre i386 6.6-2.el5_1.7 updates 112 k Transaction Summary ============================================================================= Install 0 Package(s) Update 1 Package(s) Remove 0 Package(s) Total download size: 112 k Is this ok [y/N]: y Downloading Packages: (1/1): pcre-6.6-2.el5_1.7.i386.rpm 112 kB 00:02 Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Updating : pcre ######################### [1/2] Cleanup : pcre ######################### [2/2] Updated: pcre.i386 0:6.6-2.el5_1.7 Complete! [root@rubyplus etc]# yum install pcre-devel Loading "installonlyn" plugin Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Downloading header for pcre-devel to pack into transaction set. pcre-devel-6.6-2.el5_1.7. 100% |=========================| 10 kB 00:00 ---> Package pcre-devel.i386 0:6.6-2.el5_1.7 set to be updated --> Running transaction check Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: pcre-devel i386 6.6-2.el5_1.7 updates 176 k Transaction Summary ============================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 176 k Is this ok [y/N]: y Downloading Packages: (1/1): pcre-devel-6.6-2.el5_1.7.i386.rpm 176 kB 00:02 Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: pcre-devel ######################### [1/1] Installed: pcre-devel.i386 0:6.6-2.el5_1.7 Complete! [root@rubyplus etc]# yum install zlib Loading "installonlyn" plugin Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments Nothing to do [root@rubyplus etc]# yum install zlib-devel Loading "installonlyn" plugin Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments Nothing to do [root@rubyplus etc]# yum install openssl Loading "installonlyn" plugin Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments Nothing to do [root@rubyplus etc]# yum install openssl-devel Loading "installonlyn" plugin Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments Nothing to do [root@rubyplus etc]# ./configure --sbin-path=/usr/local/sbin --with-http_ssl_module \ --with-http_ssl_module --with-http_realip_module --with-http_addition_module \ --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-mail \ --with-mail_ssl_module --with-cc-opt="-I /usr/include/pcre" --pid-path=/var/run/nginx.pid \ --lock-path=/var/lock/subsys/nginx --conf-path=/etc/nginx/nginx.conf -bash: ./configure: No such file or directory [root@rubyplus etc]# [root@rubyplus etc]# wget http://sysoev.ru/nginx/nginx-0.5.35.tar.gz --12:44:58-- http://sysoev.ru/nginx/nginx-0.5.35.tar.gz Resolving sysoev.ru... 81.19.69.70 Connecting to sysoev.ru|81.19.69.70|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 488926 (477K) [application/octet-stream] Saving to: `nginx-0.5.35.tar.gz' 100%[=========================================================>] 488,926 48.7K/s in 9.3s 12:45:08 (51.3 KB/s) - `nginx-0.5.35.tar.gz' saved [488926/488926] [root@rubyplus etc]# tar xzvf nginx-0.5.35.tar.gz nginx-0.5.35/ nginx-0.5.35/contrib/unicode2nginx/koi-utf [root@rubyplus etc]# cd nginx-0.5.35 [root@rubyplus nginx-0.5.35]# ./configure --sbin-path=/sbin/nginx \ --conf-path=/usr/local/nginx/nginx.conf \ --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module \ --with-md5=auto/lib/md5 --with-sha1=auto/lib/sha1 checking for OS + Linux 2.6.18-53.1.6.el5.028stab053.6PAE i686 checking for C compiler ... not found ./configure: error: C compiler gcc is not found [root@rubyplus nginx-0.5.35]# yum install gcc Loading "installonlyn" plugin Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Downloading header for gcc to pack into transaction set. gcc-4.1.2-14.el5.i386.rpm 100% |=========================| 64 kB 00:00 ---> Package gcc.i386 0:4.1.2-14.el5 set to be updated --> Running transaction check --> Processing Dependency: libgomp.so.1 for package: gcc --> Processing Dependency: binutils >= 2.17.50.0.2-8 for package: gcc --> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc glibc-common-2.5-18.el5_1 100% |=========================| 723 kB 00:00 ---> Package glibc-common.i386 0:2.5-18.el5_1.1 set to be updated --> Running transaction check Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: gcc i386 4.1.2-14.el5 base 5.2 M Installing for dependencies: binutils i386 2.17.50.0.6-5.el5 base 2.9 M cpp i386 4.1.2-14.el5 base 2.6 M glibc-devel i386 2.5-18.el5_1.1 updates 2.0 M glibc-headers i386 2.5-18.el5_1.1 updates 609 k libgomp i386 4.1.2-14.el5 base 76 k Updating for dependencies: glibc i686 2.5-18.el5_1.1 updates 5.1 M glibc-common i386 2.5-18.el5_1.1 updates 16 M libgcc i386 4.1.2-14.el5 base 87 k Transaction Summary ============================================================================= Install 6 Package(s) Update 3 Package(s) Remove 0 Package(s) Total download size: 35 M Is this ok [y/N]: y Downloading Packages: (1/9): binutils-2.17.50.0 100% |=========================| 2.9 MB 00:03 (2/9): gcc-4.1.2-14.el5.i 100% |=========================| 5.2 MB 00:07 (3/9): libgcc-4.1.2-14.el 100% |=========================| 87 kB 00:00 (4/9): libgomp-4.1.2-14.e 100% |=========================| 76 kB 00:00 (5/9): glibc-2.5-18.el5_1 100% |=========================| 5.1 MB 00:02 (6/9): cpp-4.1.2-14.el5.i 100% |=========================| 2.6 MB 00:02 (7/9): glibc-headers-2.5- 100% |=========================| 609 kB 00:00 (8/9): glibc-common-2.5-1 100% |=========================| 16 MB 00:07 (9/9): glibc-devel-2.5-18 100% |=========================| 2.0 MB 00:01 Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Updating : libgcc ####################### [ 1/12] Updating : glibc-common ####################### [ 2/12] Updating : glibc ####################### [ 3/12] Installing: binutils ####################### [ 4/12] Installing: libgomp ####################### [ 5/12] Installing: cpp ####################### [ 6/12] Installing: glibc-headers ####################### [ 7/12] Installing: glibc-devel ####################### [ 8/12] Installing: gcc ####################### [ 9/12] Cleanup : libgcc ####################### [10/12] Cleanup : glibc ####################### [11/12] Cleanup : glibc-common ####################### [12/12] Installed: gcc.i386 0:4.1.2-14.el5 Dependency Installed: binutils.i386 0:2.17.50.0.6-5.el5 cpp.i386 0:4.1.2-14.el5 glibc-devel.i386 0:2.5-18.el5_1.1 glibc-headers.i386 0:2.5-18.el5_1.1 libgomp.i386 0:4.1.2-14.el5 Dependency Updated: glibc.i686 0:2.5-18.el5_1.1 glibc-common.i386 0:2.5-18.el5_1.1 libgcc.i386 0:4.1.2-14.el5 Complete! [root@rubyplus nginx-0.5.35]# ./configure --sbin-path=/sbin/nginx \ --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-md5=auto/lib/md5 --with-sha1=auto/lib/sha1 checking for OS + Linux 2.6.18-53.1.6.el5.028stab053.6PAE i686 checking for C compiler ... found + using GNU C compiler + gcc version: 4.1.2 20070626 (Red Hat 4.1.2-14) checking for gcc -pipe switch ... found checking for gcc variadic macros ... found checking for C99 variadic macros ... found checking for unistd.h ... found checking for ioctl(FIONBIO) ... found checking for struct tm.tm_gmtoff ... found Configuration summary + threads are not used + using system PCRE library + using system OpenSSL library + using md5 library: auto/lib/md5 + using sha1 library: auto/lib/sha1 + using system zlib library nginx path prefix: "/usr/local/nginx" nginx binary file: "/sbin/nginx" nginx configuration file: "/usr/local/nginx/nginx.conf" nginx pid file: "/usr/local/nginx/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "/usr/local/nginx/client_body_temp" nginx http proxy temporary files: "/usr/local/nginx/proxy_temp" nginx http fastcgi temporary files: "/usr/local/nginx/fastcgi_temp" Run: make make install