首页 文章

在ubuntu上为valet安装nginx

提问于
浏览
0

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

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

invoke-rc.d:initscript nginx,action“start”失败 .

●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)

5月15日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:Unit进入失败状态 .
5月15日15:42:16 hatshep-Lenovo-ideapad-310-14IKB systemd [1]:nginx.service:结果'exit-code'失败 .

2 回答

  • 1

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

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

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

    您可以使用 netstat 查找哪个程序正在侦听端口80

    netstat -tulpn | grep ':80'
    

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

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

    systemctl stop apache2
    
  • 0

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

相关问题