97: Address family not supported by protocol,nginx服务启动失败

1、启动nginx服务报错

环境:centos 6.9,yum安装的nginx,启动报错

[root@lnmp ~]# 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

2、尝试修改配置文件

vi /etc/nginx/nginx.conf

没发现要修改的端口信息

listen 80;
仔细查看nginx的主配置文件发现include选项,包含了nginx的其他配置文件

然后继续查看发现:

3、解决办法

   vim /etc/nginx/conf.d/default.conf
将:
    listen       80 default_server;
    listen       [::]:80 default_server;
改为:
    listen       80;
    #listen     [::]:80 default_server;

启动nginx就成功了。

猜你喜欢

转载自www.cnblogs.com/yihr/p/9588964.html
97