nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)相关的知识,希望对你有一定的参考价值。

今天测试Docker下配置一个nginx模板的镜像,装好nginx后,使用nginx -t进行检查,报错如下:

[[email protected] yum.repos.d]# 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

检查配置文件:

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
根据错误提示分析,监听的方式可能不支持ipv6,于是将其注释掉
    server {
        listen       80 default_server;
#        listen       [::]:80 default_server;
然后再次检查配置:
[[email protected] yum.repos.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
没有报错了,问题解决

 


本文出自 “冰冻vs西瓜” 博客,请务必保留此出处http://molewan.blog.51cto.com/287340/1971551

以上是关于nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)的主要内容,如果未能解决你的问题,请参考以下文章

阿里云ECS在CentOS 6.9中使用Nginx提示:nginx: [emerg] socket() [::]:80 failed (97: Address family not supported

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]“流”指令在这里不允许'

[emerg]: getpwnam(“nginx”) failed

nginx - nginx:[emerg] bind()到[::]:80失败(98:地址已经在使用中)