Nginx编译安装

一、编译安装

1、上传压缩包到虚机里,rz nginx-1.3.15.tar.gz

2、解压 tar zxvf nginx-1.3.15.tar.gz

3、进到文件夹 cd nginx-1.3.15

4、编译安装:./configure --prefix=/usr/local/nginx     (这里是安装到usr/local/nginx

         make && make install

5、验证是否安装成功,访问本机ip即可(如果访问不了,关闭防火墙 service iptables stop

二、遇到的问题

1、./configure: error: the HTTP rewrite module requires the PCRE library.

解决方法:安装pcre-devel解决问题,yum -y install pcre-devel

2、./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library.   You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.

解决方法:yum -y install openssl openssl-devel

3、在使用./nginx -s reload时,报错nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

解决方法:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

三、使用

1、启动

切换到安装目录 cd /usr/loacl/nginx/sbin  >> ./nginx

2、查看nginx是否启动成功

ps -ef|grep nginx

3、停止

killall -9 nginx 或者pkill -9 nginx

4、基本操作命令(前提,需要sbin目录下 

./nginx -h #帮助   

./nginx -v #显示版本   

./nginx -V #显示版本和配置信息  

./nginx -t #测试配置   

./nginx -q #测试配置时,只输出错误信息   

./nginx -s stop #停止服务器   

./nginx -s reload #重新加载配置 

 

参考于:http://jingyan.baidu.com/article/e2284b2b45f693e2e6118de5.html

             http://jingyan.baidu.com/article/2fb0ba404f814e00f2ec5f9e.html

转载于:https://www.cnblogs.com/fun0623/p/4398876.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值