资讯专栏INFORMATION COLUMN

Nginx的各种报错总结

Tecode / 1972人阅读

摘要:复制代码报错信息如下错误错误解答执行命令安装依赖包。为了让读者理解问题,重现上述错误过程,命令如下复制代码

1、Nginx安装过程报错
错误一:软件依赖包未正确安装问题---PCRE依赖包没有安装

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

解决方法:yum install pcre pcre-devel -y
错误二:软件依赖包未正确安装问题---OPENSSL依赖包没有安装
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules or install the OpenSSL library
into the system or build the OpenSSL library statically from the source
with nginx by using --with-openssl= option.

解决方法:yum install openssl openssl-devel -y
错误三:编译安装pcre编译软件时,gcc不全导致报错(使用yum安装不存在此问题)。
复制代码
报错信息如下:
[root@gjlin2 pcre-8.30]# make && make install
make all-am
make[l]: Entering directory 7h〇me/gjlin/tools/pcre-8.30*
CXX pcrecpp.lo
libtool: compile : unrecognized option -DHAVE_CONFIG_H
libtool:compile : Try libtool --help for more information.
make[l]:*[pcrecpp.lo]错误 1
make[l]:Leaving directory /home/gjlin/tools/pcre-8.30
make : * [all]错误 2

解答:执行"yum -y install gcc-c++"命令安装gcc-c++依赖包。
复制代码
回到顶部
2、Nginx启动过程中报错
错误一:nginx软件重复启动产生的错误信息
复制代码
[root@web01 nginx-1.10.2]# /application/nginx/sbin/nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

解决方法:nginx软件已经启动无需反复启动,如果需要重新启动需要停止nginx进程或者用reload方式进行重启

复制代码
错误二:403报错
服务阻止客户端访问
服务端站点目录中,没有指定首页文件信息
错误三:启动 Nginx 时如下报错"nginx:[emerg]getpwnam(“nginx”)failed"
解答:这是因为没有对应的Nginx服务用户,执行useradd nginx -s /sbin/nologin -M创建Nginx用户即可。为了让读者理解问题,重现上述错误过程,命令如下:

复制代码
[root@web tools]# pkill nginx

[root@web tools]# userdel nginx

[root@web tools]# /application/nginx/sbin/nginx

nginx: [emerg] getpwnam(Mnginx") failed

[root@web tools]# useradd nginx -s /sbin/nologin -M

[root@web tools]# /application/nginx/sbin/nginx

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/126391.html

相关文章

  • 跨域问题汇总

    摘要:因为浏览器的同源策略,前端开发会遇到各种跨域问题。前言在总结各种跨域问题之前,我们先来了解一下浏览器的同源策略。所以只能解决一级域名相同二级域名不同的跨域问题。 跨域问题的场景和解决方案多种多样,只要是做前端开发,总会遇到。而且面试时也是必问的问题。所以自己学习总结记录一下。 因为浏览器的同源策略,前端开发会遇到各种跨域问题。本篇文章总结了遇到跨域问题的不同的场景以及对应的解决方案。 ...

    MkkHou 评论0 收藏0
  • Wordpress博客迁移至Jekyll过程总结

    摘要:想来想去还是想试试把我的博客转成一方面为了管理另一方面实在是感觉请求过多速度太慢可改造性太差经过迁移后默认主题速度杠杠的显示时间不到哦安装本文在环境下操作环境需要比较懒貌似自带还是啥时候装了不会的自己搜一下安装和目前最新稳定版本是自带源的版 想来想去还是想试试把我的博客转成Jekyll, 一方面为了git管理, 另一方面实在是感觉请求过多速度太慢, 可改造性太差. 经过迁移后, 默认主...

    高胜山 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<