Nginx(二) nginx 无法启动

有时候在客户端输入:nginx

但是终端会输出以下,显示启动失败

nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] still could not bind()

这时候可以输入:ps -ef| grep nginx

 终端会输出以下,显示占用的端口

    0   551     1   0  9:22PM ??         0:00.01 nginx: master process nginx
   -2   614   551   0  9:26PM ??         0:00.00 nginx: worker process
    0   618   606   0  9:27PM ttys000    0:00.00 grep nginx

然后输入:kill 551

来停止该端口进程。

再在终端输入:nginx

然后在浏览器输入:http://127.0.0.1:8080/

就会显示启动正常。

------------------谢谢大佬们的打赏--------------------

 

posted @ 2018-03-11 21:42  抽象Java  阅读(7299)  评论(0编辑  收藏  举报