今天测试Docker下配置一个nginx模板的镜像,装好nginx后,使用nginx -t进行检查,报错如下:
1
2
3
4
|
[root@a381c4c04132 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
|
检查配置文件:
1
2
3
4
5
6
7
8
9
10
11
12
|
server {
listen 80 default_server;
listen [::]:80 default_server;
根据错误提示分析,监听的方式可能不支持ipv6,于是将其注释掉
server {
listen 80 default_server;
# listen [::]:80 default_server;
然后再次检查配置:
[root@a381c4c04132 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西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1971551,如需转载请自行联系原作者