报错代码1如下:
[root@xiaoming nginx-1.17.]# ./configure --prefix=/soft/nginx-1.17.
checking for OS
+ Linux 3.10.-.el7.x86_64 x86_64
checking for C compiler ... not found ./configure: error: C compiler cc is not found
解决方法:
源码包的编译用到了linux系统里的编译器,通常源码包都是用C语言开发的,这里提示缺少c语言编译器,只需要使用yum仓库安装gcc这个包即可
yum install -y gcc
报错代码2如下:
./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 -y pcre-devel
报错代码3:
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
解决方法:
同代码2一样,同样缺少zlib库文件,我们只要安装zlib-devel即可
yum install -y zlib-devel
报错代码3:
nginx: [emerg] getgrnam("www--with-http_ssl_module") failed
解决办法:
由于--group=www与--with-http_ssl_module之间没空格符号分开,导致openssl-devel第一遍装的时候没被使用
1.切换到nginx源码包
# cd /soft/src/nginx-1.17.7
2.查看nginx原有的模块
# /soft/src/nginx-1.17.7/sbin/nginx -V
3.这时候执行/soft/src/nginx-1.17.1/configure指令
4.配置完成后,运行命令make 这里不要进行make install,否则就是覆盖安装
5.然后备份原有已安装好的nginx ,cp /soft/nginx-1.17.7/sbin/nginx /tmp
6.然后将刚刚编译好的nginx覆盖掉原有的nginx(这个时候nginx要停止状态)
cp /soft/src/nginx-1.17.7/sbin/nginx /soft/nginx-1.17.7/sbin/
这时候重启nginx服务即可