运维开发网

NO.A.0001——nginx常见报错处理

运维开发网 https://www.qedev.com 2020-11-20 12:33 出处:51CTO 作者:yanqi_vip
问题一:[[email protected]~]#./configure--prefix=/usr/local/nginx--user=www--group=www--with-http_stub_status_modulebash:./configure:Nosuchfileordirectory//解决思路:表示在执行预编译./configure没有找到configure执行文件,改文件不存在

问题一:

[[email protected] ~]# ./configure --prefix=/usr/local/nginx  --user=www   --group=www  --with-http_stub_status_module 
bash: ./configure: No such file or directory
//解决思路:表示在执行预编译./configure没有找到configure执行文件,改文件不存在。
//解决方法:检查执行命令时是否在该源代码的目录之下。

问题二:

[[email protected] nginx-1.16.0]# ./configure --prefix=/usr/local/nginx  --user=www   --group=www  --with-http_stub_status_module
checking for C compiler ... not found
./configure :error:C compiler cc is not found 
//解决思路:表示在编译时Nginx软件服务时,需要提前检测Linux操作系统是否存在GCC编译环境,错误显示c编译器没有找到,c编译器对应的CC工具不存在。
[[email protected] nginx-1.16.0]# whereis cc    //检测cc是否存在
[[email protected] nginx-1.16.0]# which cc
//解决方法:
[[email protected] ~]#  yum -y install gcc

问题三:

//通过MAKE源码方式编译Nginx WEB平台,执行预编译参数,
[[email protected] ~]# ./configure --prefix=/usr/local/nginx  --user=www   --group=www  --with-http_stub_status_module 
./configure:error:the HTTP rewrite module requires the PCRE library.
You can either disable the module by using 
--without-http_rewrite_module
//解决思路:根据如上错误提示,表示安装Nginx软件服务时,需要开启Rewrite模块功能(浏览器访问URL地址可以实现重定向,跳转)而rewrite模块功能需要查找和依赖Linux操作系统PCRE LIB库(Perl语言的正则库)而PCRE LIB库没有找到,所以报错。
//重定向: 从一个网址跳到另外一个网址,通过rewrite功能实现。
[[email protected] nginx-1.16.0]# find / -name "*pcre*.so"   //查找有没有PCRE库。find不到万不得已不要用,用的话会做背锅侠,跟rm -rf类似,会消耗系统的性能。
//解决方法:通过yum安装PCRE库:
[[email protected] nginx-1.16.0]# yum -y install pcre pcre-devel     //pcre是主程序,pcre-devel是开发库。

问题四:

//通过MAKE源码方式编译Nginx WEB平台,执行预编译参数,
[[email protected] ~]# ./configure --prefix=/usr/local/nginx  --user=www   --group=www  --with-http_stub_status_module 
You can either disable the module by using --without-http_gzip_module
//解决思路:根据如上错误提示,表示安装nginx web软件服务时,需要开启GZIP模块功能,(用于nginx开启压缩功能,对应静态网页,文件压缩)需要依赖Linux操作系统Zlib库,而Linux操作系统Zlib库没有找到,所以报错。
//解决方案:通过手动方式安装zlib库文件,
[[email protected] ~]# yum -y install zlib zlib-devel 

问题五:

[[email protected] ~]# /usr/local/nginx/sbin/nginx 
nginx: [emerg] getpwnam("www") failed       
//解决思路:没有创建用户
//解决方案:创建用户和用户组
[[email protected] ~]# groupadd  www
[[email protected] ~]# useradd  -g  www www
[[email protected] ~]# usermod  -s  /sbin/nologin  www

问题六:

若web网页无法访问我们的网页;
解决方案:
1、本地ping一下我们的主机是否允许
2、查看进程:ps -ef |grep  -aw nginx
3、查看端口是否开启:netstat -tunlp |grep 80
4、端口服务都没有问题;查看服务器防火墙80 端口是否开启
查看防火墙规则:
[[email protected] ~]# firewall-cmd --list-all --zone=public
FirewallD is not running

问题七:

//nginx从1.16.降级为1.10.3版本预编译报错:
[[email protected] nginx-1.10.3]# ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module
src/core/ngx_murmurhash.c:37:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
         h ^= data[2] << 16;
         ~~^~~~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:38:5: note: here
     case 2:
     ^~~~
src/core/ngx_murmurhash.c:39:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
         h ^= data[1] << 8;
         ~~^~~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:40:5: note: here
     case 1:
     ^~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:460: objs/src/core/ngx_murmurhash.o] Error 1
make[1]: Leaving directory '/root/nginx-1.10.3'
make: *** [Makefile:8: build] Error 2
解决思路:
解决方案:
待补充:
备注:解决思路:https://www.jiweichengzhu.com/article/cc4ed4eeb4644586b81e9070a96c0bda

问题八:

[[email protected] ~]# yum -y install mariadb-server mariadb mariadb-devel
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:08:24 ago on Tue Nov  3 07:48:24 2020.
Error: 
 Problem: problem with installed package mysql-devel-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
  - package mysql-devel-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 conflicts with mariadb-devel provided by mariadb-devel-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64
  - package mariadb-devel-3:10.3.17-1.module_el8.1.0+257+48736ea6.x86_64 conflicts with mysql-devel provided by mysql-devel-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
  - conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
解决思路:提供的软件包与Linux默认程序的软件包冲突:加入选项: --allowerasing替换掉就OK
解决方案:[[email protected] ~]# yum -y install mariadb-server mariadb mariadb-devel --allowerasing

问题九:

[[email protected] ~]# yum -y install php php-devel php-fpm php-mysqlnd 
Last metadata expiration check: 0:19:44 ago on Tue Nov  3 07:48:24 2020.
No match for argument: php-mysql
Error: Unable to find a match: php-mysql
解决思路:可能是名字错误:php-mysql 改为php-mysqlnd即可
解决方案:
[[email protected] ~]# yum -y install php php-devel php-fpm php-mysqlnd  php-devel

扫码领视频副本.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号