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

来源:互联网 发布:java script简明教程 编辑:程序博客网 时间:2024/05/17 08:07

系统只安装了基本系统

先创建用于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

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 孩子缺乏自控能力该怎么办 名片上换了号码怎么办 格力空调显示u8怎么办 格力空调出现u8怎么办 双肺多发斑点影怎么办 外文翻译没5000字怎么办 睡出永久睡痕怎么办 英语不好学学英文软件怎么办 遥控汽车只能原地打转怎么办 铝合金门上的胶带纸撕不掉怎么办 纸胶带撕不下来怎么办 拼多多卖不出去怎么办 联想键盘被锁了怎么办 台式电脑打不开机怎么办 文件名中不能用特殊符号怎么办 高铁喷雾扣留后怎么办 高铁没收的东西怎么办 安检被收的东西怎么办 我的律师骗我怎么办 没婆婆生了小孩怎么办 没人帮你带孩子怎么办 亲戚在家里不走怎么办 穷人家的孩子该怎么办 空腹吃李子胃疼怎么办 情侣空间农场谷仓空间不够怎么办 王者荣耀情侣解除对方不同意怎么办 oppo手机进了水怎么办 淘宝卖号被骗了怎么办 淘宝买号被骗了怎么办 后脑偏头疼怎么办最快最有效 脸两边的骨头大怎么办 做b超胎儿老盘腿怎么办 裤子白边染色了怎么办 异地恋要分手了怎么办 异地恋没话题了怎么办 陪婆婆聊天心情超级郁闷怎么办? 他不想理你了怎么办 陌陌看到信息不回怎么办 qq的文档看不了怎么办 怀孕了分手了怎么办啊 qq节日祝福关了怎么办