1. 程式人生 > >97: Address family not supported by protocol,nginx服務啟動失敗

97: Address family not supported by protocol,nginx服務啟動失敗

soc wid image protoc toc gin file 技術 14.

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就成功了。

97: Address family not supported by protocol,nginx服務啟動失敗