在ubuntu上为valet安装nginx

时间:2018-05-10 18:50:31

标签: nginx ubuntu-16.04 laravel-valet

我正在尝试在Ubuntu 17.10上安装valet但我遇到了nginx包的问题。它给了我这个错误:

See "systemctl  status nginx.service" and "journalctl  -xe" for details.

invoke-rc.d:initscript nginx,action“start”failed。

●nginx.service - 高性能Web服务器和反向代理服务器    已加载:已加载(/lib/systemd/system/nginx.service;已启用;供应商预设:已启用)
   活动:失败(结果:退出代码)自星期四2018-05-10 15:42:16 -03; 32ms前      文件:man:nginx(8)
  进程:14383 ExecStart = / usr / sbin / nginx -g守护进程; master_process on; (code = exited,status = 1 / FAILURE)
  进程:14382 ExecStartPre = / usr / sbin / nginx -t -q -g daemon on; master_process on; (code = exited,status = 0 / SUCCESS)

may 10 15:42:14 hatshep-Lenovo-ideapad-310-14IKB nginx [14383]:nginx:[emerg] bind()到[::]:80失败(98:地址已经在使用中)
5月15日15:42:15 hatshep-Lenovo-ideapad-310-14IKB nginx [14383]:nginx:[emerg] bind()到0.0.0.0:80失败(98:地址已经在使用中)
5月15日15:42:15 hatshep-Lenovo-ideapad-310-14IKB nginx [14383]:nginx:[emerg] bind()到[::]:80失败(98:地址已经在使用中)
5月15日15:42:15 hatshep-Lenovo-ideapad-310-14IKB nginx [14383]:nginx:[emerg] bind()到0.0.0.0:80失败(98:地址已经在使用中)
5月15日15:42:15 hatshep-Lenovo-ideapad-310-14IKB nginx [14383]:nginx:[emerg] bind()到[::]:80失败(98:地址已经在使用中)
5月15日15:42:16 hatshep-Lenovo-ideapad-310-14IKB nginx [14383]:nginx:[emerg]仍然无法绑定()
5月15日15:42:16 hatshep-Lenovo-ideapad-310-14IKB systemd [1]:nginx.service:控制进程退出,代码=退出状态= 1
5月15日15:42:16 hatshep-Lenovo-ideapad-310-14IKB systemd [1]:无法启动高性能Web服务器和反向代理服务器。
5月15日15:42:16 hatshep-Lenovo-ideapad-310-14IKB systemd [1]:nginx.service:单位进入失败状态。
5月15日15:42:16 hatshep-Lenovo-ideapad-310-14IKB systemd [1]:nginx.service:结果'exit-code'失败。

2 个答案:

答案 0 :(得分:1)

默认情况下,nginx配置为侦听端口80。

nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

此错误消息告诉您,ng​​inx无法侦听端口80,因为某些其他程序已在侦听该端口。这可能是另一个Web服务器,例如apache。

您可以使用netstat

找出正在端口80上侦听的节目
netstat -tulpn | grep ':80'

要启动nginx,您必须停止该程序,或者配置nginx以使其listens位于不同的端口上。

如果其他程序是apache,则可以使用以下命令将其停止:

systemctl stop apache2

答案 1 :(得分:0)

我可以安装代客,只需要停止apache2 !!