nginx编译安装

nginx编译安装
下载安装包 nginx-1.3.15.tar.gz
 
  tar zxvf nginx-1.3.15.tar.gz
  cd nginx-1.3.15/
 
  
进行编译
    ./configure --user=www --group=www --prefix=/usr/local/nginx  
    \--with-http_stub_status_module --with-http_ssl_module
 
make && make install
 
 
遇到的问题
 
  • ./configure: error: C compiler cc is not found
      解决方法:yum -y install gcc 
  •   安装GCC后再次运行
./configure --user=www --group=www --prefix=/usr/local/nginx  
    \--with-http_stub_status_module --with-http_ssl_module
报错:

hecking for PCRE library ... not found

checking for PCRE library in /usr/local/ ... not found
checking for PCRE library in /usr/include/pcre/ ... not found
checking for PCRE library in /usr/pkg/ ... not found
checking for PCRE library in /opt/local/ ... not found

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

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

  • 再次运行
./configure --user=www --group=www --prefix=/usr/local/nginx  
    \--with-http_stub_status_module --with-http_ssl_module

报错:

checking for PCRE JIT support ... not found
checking for OpenSSL library ... not found

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.

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

 最后运行

./configure --user=www --group=www --prefix=/usr/local/nginx  
    \--with-http_stub_status_module --with-http_ssl_module
 
make && make install
 

安装完毕后用/usr/local/nigix/sbin/

启动nginx     #./nginx 

启动nginx2    /usr/local/nginx/sbin/nginx

遇到的问题

启动nginx报nginx: [emerg] getpwnam("www") failed

 

在nginx.conf中 把user nobody的注释去掉既可

 

检查是否启动成功:

netstat -ano|grep 80 有结果输入说明启动成功

  打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功 

ps:注意:此处需要关闭防火墙 service iptables stop

重启

/usr/local/nginx/sbin/nginx –s reload

或者 killall -HUP nginx

参考链接:http://www.cnblogs.com/zhuhongbao/archive/2013/06/04/3118061.html

转载于:https://www.cnblogs.com/AliceAn/p/4225349.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值