首页 > 系统相关 >关于nginx-启动报错nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)

关于nginx-启动报错nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)

时间:2023-02-07 19:02:11浏览次数:66  
标签:QQ protocol failed server nginx 报错 80 5201351

今天在一台服务器上使用yum安装了nginx,然后启动报错:nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)

先说一下环境,

OS Release :Red Hat Enterprise Linux release 8.1 (Ootpa)

nginx version: nginx/1.14.1 

[使用nginx -v可以看到版本,大写的V除了版本,还可以看到configure options]

安装完成后,启动报错,再进一步看报错详情,如下:

[root@QQ-5201351 ~]# systemctl restart nginx
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
[root@QQ-5201351 ~]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2023-02-07 18:37:22 CST; 7s ago
  Process: 2482 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
  Process: 2480 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Feb 07 18:37:22 QQ-5201351 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Feb 07 18:37:22 QQ-5201351 nginx[2482]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Feb 07 18:37:22 QQ-5201351 nginx[2482]: nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
Feb 07 18:37:22 QQ-5201351 nginx[2482]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 07 18:37:22 QQ-5201351 systemd[1]: nginx.service: Control process exited, code=exited status=1
Feb 07 18:37:22 QQ-5201351 systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 07 18:37:22 QQ-5201351 systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
[root@QQ-5201351 ~]#

其实也可以通过 nginx -t 检查配置文件,会显示配置文件错误

[root@QQ-5201351 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
nginx: configuration file /etc/nginx/nginx.conf test failed

通过报错,可以看出,实际是提示系统不支持ipv6,因为公司本身也没有用到ipv6,因此可以直接将配置文件的ipv6监听部分注释掉即可

 

解决方法>>>>>>>>: 

1、编辑/etc/nginx/nginx.conf 配置文件,找到如下部分

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;

2、注释掉ipv6监听的那一行就可以了,最后如下

    server {
        listen       80 default_server;
        #listen       [::]:80 default_server;

这时再通过nginx -t 或者 直接启动nginx,就不会有报错了~

 

 

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/17099497.html

 

标签:QQ,protocol,failed,server,nginx,报错,80,5201351
From: https://www.cnblogs.com/5201351/p/17099497.html

相关文章

  • FastDFS6.06 +nginx部署
    环境:centos7x86-64两台:172.20.146.31  storage172.20.146.32  storage  tracker nginx 下载安装包:https://github.com/happyfish100/fastdfs/archive/refs......
  • 解决“ORA-00937: 不是单组分组函数”报错
    原SQL:selectdistincta.begin_exec_time,b.drug_code,b.drug_name,b.drug_spec,sum(b.public_retail_price*a.total_drug)as"总金额",b.public_retail_pricefromZOE......
  • 创建topic报错的解决方法
    问题:创建topic时报如下错误解决方法:1、编辑报错的创建topic文件2、输入命令::setff如果fileformat=dos,说明是windos文件格式,需要换成unix格式3、输入命令::setff=unix......
  • 【Nginx】- nginx安装
    1、检查一下防火墙systemctlstopfirewalld.service(关闭防火墙)systemctlstartfirewalld.service(开启防火墙)systemctldisablefirewalld.service(禁止防火墙自启......
  • 理论+实践,教你如何使用Nginx实现限流
    摘要:Nginx作为一款高性能的Web代理和负载均衡服务器,往往会部署在一些互联网应用比较前置的位置。此时,我们就可以在Nginx上进行设置,对访问的IP地址和并发数进行相应的限制。......
  • Nginx和tomcat实现负载均衡
    拓扑图:推荐步骤:Nginx服务器开启路由功能,客户端和tomcat服务器配置IP地址设置正确安装tomcat服务器配置网站安装Nginx代理和负载均衡功能配置DNS服务器域名解析,客户端使用w......
  • 微信小程序导入项目:报错 [app.json文件内容错误]app.json未找到 解决
    打开微信小程序控制台报错:原因:找不到入口中的文件。第一级文件目录里确实找不到app.json文件,但是打开二级目录可以看到app.json解决方法:1、在project.config.json文件......
  • RMI访问IP和返回IP不一致 报错返回的IP路由不可达 no route to host
    问题:RMI的日志探测报错返回IP和入参的IP不一致并且报错noroutetohost情况分析:根据日志打印可以定位到报错位置 这里为调用java提供的APIIRmiServicermiServi......
  • centos7+nginx+uwsgi+python3.7.4+django部署实践
    yuminstallpython3yuminstallpython3-develyum-yinstallgccgcc-c++pip3installuwsgipython3​​manage.py​​runserver10.5.1.65:82uwsgi--iniuwsgi.i......
  • 关于docker-compose up执行以后的一个报错
    docker-composeup -d报错:DETAIL:ThedatadirectorywasinitializedbyPostgreSQLversion10,whichisnotcompatiblewiththisversion12.6(Debian12.6-1......