You can either disable the module by using --without-http-cache option, or install the OpenSSL libra

系统只安装了基本系统

先创建用于Nginx运行的用户和组:

groupadd www

useradd -g www www

cd 到nginx源码根目录下,运行

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

报以下错误:

 

./configure: error: C compiler gcc is not found

原因是没有安装gcc编译器,运行yum install gcc 安装gcc,会下载以下package:

gcc, cpp, glibc-devel, glibc-headers, kernel-headers, libgomp,大约12M左右。

再次运行./configure命令,还不能安装,出现以下错误:
./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.

以为没有安装pcre,就运行了yum install pcre命令,系统提示已安装,百度了下,好象漏了个pcre-devel没装,运行yum install pcre-devel 后,该错误消失了。

但再运行./configure报另外一个错误:

./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.

估计是ssl的扩展没有装,运行yum install openssl-devel安装该库

 

这时运行./configure没有报错了。

接着运行make

make install

安装成功!

 

因为我是装在虚拟机里的,在虚拟机里可以访问到nginx服务,但在虚拟机外就无法访问了,原因是系统有防火墙,关掉就可以了。

关闭防火墙命令:service iptables stop(立刻生效) 或 chkconfig iptables off(重启才能生效)

 

编译时未指定路径,nginx默认是安装在 /usr/local/nginx/ 目录下。

启动nginx方法:/usr/local/nginx/sbin/nginx

关闭nginx方法:/usr/local/nginx/sbin/nginx -s stop ,要看详细的运行控制参数用 -h 参数即可。

Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
  -?,-h         : this help
  -v            : show version and exit
  -V            : show version and configure options then exit
  -t            : test configuration and exit
  -q            : suppress non-error messages during configuration testing
  -s signal     : send signal to a master process: stop, quit, reopen, reload
  -p prefix     : set prefix path (default: /usr/local/nginx/)
  -c filename   : set configuration file (default: conf/nginx.conf)
  -g directives : set global directives out of configuration file


原文链接:http://tetop.blog.51cto.com/1883288/747392

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值