启动nginx,报错信息及修改方法
2018-01-11 本文已影响28人
lookphp
按照上面的教程按照好nginx、PHP、mysql后,在命令行中使用命令nginx -t
测试nginx时,产生以下错误问题:
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
经过百度一下,修改方法如下:
vim /etc/nginx/conf.d/default.conf
将:
listen 80 default_server;
listen [::]:80 default_server;
改为:
listen 80;
#listen [::]:80 default_server;
启动nginx就可以了。
/usr/sbin/nginx -c /etc/nginx/nginx.conf
查看进程号:
ps -ef | grep nginx
结果如下:
root 13703 1 0 17:49 ? 00:00:00 nginx: master process nginx -c /etc/nginx/nginx.conf
nginx 13704 13703 0 17:49 ? 00:00:00 nginx: worker process
root 13706 13639 0 17:49 pts/0 00:00:00 grep nginx
启动成功!