前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Nginx的各种报错总结

Nginx的各种报错总结

作者头像
863987322
发布2018-01-24 14:38:00
1K0
发布2018-01-24 14:38:00
举报
文章被收录于专栏:Linux运维学习之路

1、Nginx安装过程报错

错误一:软件依赖包未正确安装问题---PCRE依赖包没有安装

代码语言:javascript
复制
      ./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.

解决方法:yum install pcre pcre-devel -y

错误二:软件依赖包未正确安装问题---OPENSSL依赖包没有安装

代码语言:javascript
复制
 ./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=<path> option.

解决方法:yum install openssl openssl-devel -y

错误三:编译安装pcre编译软件时,gcc不全导致报错(使用yum安装不存在此问题)。

代码语言:javascript
复制
报错信息如下:
[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软件重复启动产生的错误信息

代码语言:javascript
复制
[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用户即可。为了让读者理解问题,重现上述错误过程,命令如下:

代码语言:javascript
复制
[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
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-01-03 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、Nginx安装过程报错
    • 错误一:软件依赖包未正确安装问题---PCRE依赖包没有安装
      • 错误二:软件依赖包未正确安装问题---OPENSSL依赖包没有安装
        • 错误三:编译安装pcre编译软件时,gcc不全导致报错(使用yum安装不存在此问题)。
        • 2、Nginx启动过程中报错
          • 错误一:nginx软件重复启动产生的错误信息
            • 错误二:403报错
              • 错误三:启动 Nginx 时如下报错"nginx:[emerg]getpwnam(“nginx”)failed"
              领券
              问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档