1. 程式人生 > >nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)

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

nginx

今天測試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)