linux下nginx不能启动原因有如下几个:
nginx: [emerg] to [::]:80 failed (98: Address already in use)
[emerg] 5780#5555: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)
端口或者进程已经存在
可以利用netstat -ntpl查看当前都开启了哪些端口,用ps -ef|grep nginx来查看进程在不在
如果端口和进程在,就用pkill -9 nginx 或者killall nginx,但让占用80端口的不一定是nginx,也有可能是其它进程,killall xx直接杀掉即可
“server” directive is not allowed here in /etc/nginx/nginx.conf:66
出现这个错误,一般都是配置文件写错了,不符合nginx配置格式,所以配置或者更新nginx配置文件时候先用nginx -t测试配置文件是否正确,以免强行重启导致nginx服务不能工作
nginx其它不能启动情况,一定要通过查看nginx错误日志来,分析,日志会给出直接原因。
评论列表