[root@localhost conf]# nginx -p `pwd`/ -c nginx.conf
nginx: [emerg] bind() to 0.0.0.0:8088 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8088 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8088 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8088 failed (98: Address already in use)
分析原因:8088端口已经被占用,解决办法如下:
查看8088是那个进程在占用
netstat -ntpl
如果是nginx进程,则杀死该进程,执行如下命令:
killall -9 nginx
然后在重新启动nginx服务,执行如下命令即可。
nginx -p `pwd`/ -c nginx.conf
nginx启动后,刷新页面访问不了,原因:防火墙问题,解决办法执行如下命令(备注:系统是CentOS):
sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service