# 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
The above error indicates that ipv6 is disabled on your server, hence service is and failed due to unsupported address family.
To resolve this issue, we need to edit the nginx configuration file, and comment out the below line(add # in front of it):
listen [::]:80;
Then restart the nginx service.
/etc/init.d/nginx restart
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful