LFSトップ | Japanese Only2010/02/07

Nginx-0.8.33

はじめに

ソース入手

依存パッケージ

ビルド

groupadd -g 25 nginx
useradd -c "Nginx Server" -d /dev/null -g nginx \
        -s /bin/false -u 25 nginx
/configure --prefix=/usr \
	--conf-path=/etc/nginx/nginx.conf \
	--error-log-path=/var/log/error.log \
	--http-log-path=/var/log/access.log \
	--pid-path=/var/run/nginx.pid \
	--lock-path=/var/lock \
	--user=nginx \
	--group=nginx \
	--http-fastcgi-temp-path=/tmp/fcgi \
	--http-client-body-temp-path=/tmp/cb \
	--http-proxy-temp-path=/tmp/proxy

make
make install top_dir=/usr/lib/apachemake install
install -v -m755 -d /var/www/nginx-default
cp -pv html/* /var/www/nginx-default

デーモンスクリプトのインストール

patch -Np1 -i ../blfs-bootscripts-20090302_add-nginx.patch.txt
patching file Makefile
patching file blfs/init.d/nginx
make install-nginx
install -d -m 755 /etc/rc.d/rc{0,1,2,3,4,5,6,sysinit}.d
install -d -m 755 /etc/rc.d/init.d
install -d -m 755 /etc/sysconfig
install -m 754 blfs/init.d/nginx     /etc/rc.d/init.d/
ln -sf  ../init.d/nginx /etc/rc.d/rc0.d/K28nginx
ln -sf  ../init.d/nginx /etc/rc.d/rc1.d/K28nginx
ln -sf  ../init.d/nginx /etc/rc.d/rc2.d/K28nginx
ln -sf  ../init.d/nginx /etc/rc.d/rc3.d/S32nginx
ln -sf  ../init.d/nginx /etc/rc.d/rc4.d/S32nginx
ln -sf  ../init.d/nginx /etc/rc.d/rc5.d/S32nginx
ln -sf  ../init.d/nginx /etc/rc.d/rc6.d/K28nginx

デーモンスクリプトの起動

/etc/rc.d/init.d/nginx start
Starting Nginx daemon...                                                         [  OK  ]

動作確認

http://ServerName/
wget -S --spider http://localhost/
スパイダーモードが有効です。リモートファイルが存在してるか確認します。
--2010-02-07 16:53:07--  http://localhost/
localhost をDNSに問いあわせています... 127.0.0.1
localhost|127.0.0.1|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています...
  HTTP/1.1 200 OK
  Server: nginx/0.8.33
  Date: Sun, 07 Feb 2010 07:53:07 GMT
  Content-Type: text/html
  Content-Length: 151
  Last-Modified: Sun, 07 Feb 2010 07:48:32 GMT
  Connection: keep-alive
  Accept-Ranges: bytes
長さ: 151 [text/html]
リモートファイルが存在し、さらなるリンクもあり得ますが、再帰が禁止されています -- 取得しま
せん。
ps -ef | grep nginx
root     22490     1  0 16:52 ?        00:00:00 nginx: master process /usr/sbin/nginx
nginx    22491 22490  0 16:52 ?        00:00:00 nginx: worker process
root     22500 20441  0 16:54 pts/4    00:00:00 grep nginx
tail -n 1 /var/log/access.log
192.168.202.1 - - [07/Feb/2010:17:14:47 +0900] "GET / HTTP/1.1" 304 0 "-" "Mozilla/4.0 (co
mpatible; MSIE 6.0; Windows NT 5.1; SV1; GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET 
CLR 3.0.04506.30; .NET CLR 1.0.3705; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
tail -n 1 /var/log/error.log
2010/02/07 16:36:35 [error] 20439#0: *1 open() "/usr/html/favicon.ico" failed (2: No such 
file or directory), client: 192.168.202.1, server: localhost, request: "GET /favicon.ico H
TTP/1.1", host: "192.168.202.130"

ベース環境

cat /etc/lfs-release
SVN-20100201


松 山 道 夫 Michio Matsuyama
michio *underscore* matsuyama *atmark* yahoo *period* co *period* jp