nginx安装启动

参考:http://network.51cto.com/art/201005/198198_4.htm
下载nginx  tar.gz安装包
下载pcre tar.gz安装包

安装pcre
tar zxvf pcre-7.9.tar.gz
cd pcre-7.9

./configure

 

make && make install
安装nginx
tar zxvf nginx-0.7.61.tar.gz
cd nginx-0.7.61
./configure --with-http_stub_status_module --prefix=/usr/local/nginx
#
--with-http_stub_status_module 是监控模块
#
make && make install

##不加--without-http_rewrite_module这个参数时就是启动URL重写,所以需要pcre
##./configure --with-http_stub_status_module --without-http_rewrite_module --prefix=/usr/local/nginx

-----------------------------------------------------------------------
#出现错误(参考地址 http://www.kwx.gd/CentOSApp/nginx-gzip-requires-zlib.html)
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using –without-http_gzip_module
option, or install the zlib library into the system, or build the zlib
library
statically from the source with nginx by using –with-zlib=<path> option.

则需要安装“zlib-devel”即可。SSH执行以下命令:
yum install -y zlib-devel
------------------------------------------------------------------------

配置文件
目录 /usr/local/nginx/conf/nginx.conf
配置请看 http://www.cnblogs.com/loveismile/p/3875721.html

启动
/usr/local/nginx/sbin/nginx &

重启
/usr/local/nginx/sbin/nginx -s reload

帮助
/usr/local/nginx/sbin/nginx -h

检查nginx.conf配置文件
/usr/local/nginx/sbin/nginx -t
 
posted on 2014-07-29 11:40  Love I Smile  阅读(215)  评论(0编辑  收藏  举报