1、安装Nginx所需的pcre库
wget http://www.92csz.com/downloads/pcre-8.12.tar.gz
tar zxvf pcre-8.12.tar.gz
cd pcre-8.12
./configure
make && make install
cd ..
2、安装nginx
wget http://nginx.org/download/nginx-1.2.7.tar.gz
tar zxvf nginx-1.2.7.tar.gz
cd nginx-1.2.7
./configure --user=www --group=www --prefix=/data/soft/nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_dav_module --with-http_flv_module --with-http_addition_module --with-http_sub_module
make && make install
cd ..
3、创建nginx配置文件
rm -f /data/soft/nginx/conf/nginx.conf
vi /data/soft/nginx/conf/nginx.conf
4、启动nginx并进行测试
/data/soft/nginx/sbin/nginx -t
/data/soft/nginx/sbin/nginx
mkdir -p /data/www/test
echo "<?php phpinfo();?>" > /data/www/test/index.php
echo "/data/soft/nginx/sbin/nginx" >> /etc/rc.local