云主机启动nginx报错,80 failed (97: Address family not supported by protocol)

最近想使用云服务器来部署自己的web应用。
利用yum install nginx安装了nginx后,
用命令service nginx start 启动时,出现错误如下

[root@VM_0_13_centos ~]# service nginx start
Starting nginx: nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
                                                           [FAILED]

最后根据网上的资料,解决方法如下
找到nginx的配置文件:

vim /etc/nginx/conf.d/default.conf

内容如下

#
# The default server
#

server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  _;
    root         /usr/share/nginx/html;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
    }

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }

}

listen       [::]:80 default_server;

该部分注释掉即可

[root@VM_0_13_centos conf.d]# service nginx start
Starting nginx:                                            [  OK  ]

猜你喜欢

转载自blog.csdn.net/u010398838/article/details/79359591