Nginx报”Address family not supported by protocol”错误无法启动解决方案

今天在做网站迁移时,通过宝塔面板,安装LNMP环境后,发现Nginx报错无法启动,现将解决方案记录如下。

Nginx报

报错内容如图,并且把报错内容进行了摘抄。

Nginx配置规则错误: 
nginx: the configuration file /www/server/nginx/conf/nginx.conf syntax is ok
nginx: [emerg] socket() [::]:888 failed (97: Address family not supported by protocol)
nginx: configuration file /www/server/nginx/conf/nginx.conf test failed

解决方法是在Nginx配置里,注释掉端口监听,即打开Nginx配置

listen       888 ;
listen       [::]:888 ;

改为:

listen       888;
#listen       [::]:888;

如下图所示,重载Nginx配置,就可以正常启动。
Nginx报