一、安装pcre-8.02.tar.gz
[root@localhost opt]# tar -zxvf pcre-8.02.tar.gz
[root@localhost opt]# cd pcre-8.02
[root@localhost pcre-8.02]# ./configure
[root@localhost pcre-8.02]# make
[root@localhost pcre-8.02]# make install
二、安装nginx-0.8.54.tar.gz
[root@localhost opt]# tar -zxvf nginx-0.8.54.tar.gz
[root@localhost opt]# cd nginx-0.8.54
[root@localhost nginx-0.8.54]# ./configure --prefix=/usr/local/nginx/ --with-http_stub_status_module --with-openssl=/usr/local/openssl
[root@localhost nginx-0.8.54]# make
[root@localhost nginx-0.8.54]# make install
三、测试启动nginx
[root@localhost sbin]# pwd
/usr/local/nginx/sbin
3.1、测试
[root@localhost sbin]# ./nginx -t
the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok
configuration file /usr/local/nginx//conf/nginx.conf test is successful
[root@localhost sbin]#
3.2、启动和停止
启动:
[root@localhost sbin]# ./nginx
查看主进程号:
[root@localhost sbin]# ps -ef | grep "nginx: master process" | grep -v "grep" | awk -F ' ' '{print $2}'
10812
[root@localhost sbin]#
杀掉主进程:
kill -HUP 10812
停止nginx:
[root@localhost sbin]# ./nginx -s stop
或者
[root@localhost nginx]# find / -name nginx.pid
/usr/local/nginx/logs/nginx.pid
[root@localhost nginx]# kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
[root@localhost nginx]#
注意:上面的“`”是“~”下面的符号。