栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Ubuntu20.04 nginx 编译、配置错误处理

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Ubuntu20.04 nginx 编译、配置错误处理

具体安装教程点这里

配置过程参考了这篇文章

下面主要记录在执行 ./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= option.

 执行下列安装此问题解决。

sudo apt-get install libpcre3 libpcre3-dev

第二个问题:

继续报错

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

根据提示需要安装zlib

按照以下代码操作。

wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -xzvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install
 第三个问题:
./configure: error: SSL modules require the OpenSSL library.

 原因是编译支持https但缺少OpenSSL库文件。
解决办法:

sudo apt-get install openssl-dev

第四个问题

执行make后还是继续报错,查了一下,这个问题一般不是Nginx的版本高就是服务器版本高的问题

src/os/unix/ngx_user.c: In function ‘ngx_libc_crypt’:
src/os/unix/ngx_user.c:26:7: error: ‘struct crypt_data’ has no member named ‘current_salt’
   26 |     cd.current_salt[0] = ~salt[0];
      |       ^

解决办法:
就进去报错目录下(/usr/local/src/nginx-1.14.1/src/os/unix/ngx_user.c),打开指定的报错文件,将报错行注释

第五个问题

1|cc1: all warnings being treated as errors

找到当前目录下找到objs文件夹,并进入,打开文件Makefile,找到有一下内容的这行:

1 | CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g

把这行内容中的 “-Werror”去掉

-Werror: gcc将所有的警告当成错误进行处理。

第六个问题:

在配置完https之后,启动nginx时,遇到了如下问题。

nginx: [error] open() “/usr/local/nginx/logs/nginx.pid” failed (2: No such file or directory)

解决方案:网上搜集了一下资料,两种解决方案。

1.nginx.conf的nginx.pid被注释了

进入nginx.conf目录编辑

sudo vim /usr/local/nginx/conf/nginx.conf

将注释取消,在重新启动。

sudo nginx -s reload
 2.没有指定配置目录。完成这一步之后,才重启成功的。

输入来使用指定nginx.conf文件的方式重启nginx(首先保证上面第一种情况的pid没有被注释,否则可能前两次能打开,但是以后还是会报错的)

sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/323563.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号