由于nginx源码安装需要依赖部分库文件,需要提前准备好:zlib-1.2.11 pcre-8.33 openssl-1.0.1j。
--配置
./configure --user=root --prefix=/usr/local/nginx --with-pcre=../pcre-8.38/ --with-zlib=../zlib-1.2.11/ --with-openssl=../openssl-1.0.1j/ --with-http_auth_request_module
--编译
make
--安装
make install
--配置自启动
vi /etc/init.d/nginx
--添加可执行权限
chmod a+x /etc/init.d/nginx
--先将nginx服务加入chkconfig管理列表:
chkconfig --add /etc/init.d/nginx
--加完这个之后,就可以使用service对nginx进行启动,重启等操作了。
service nginx start
service nginx stop
--设置终端模式开机启动:
chkconfig nginx on