0

I'm trying to install valet on Ubuntu 17.10 but I have problems with the nginx package which is requested. It gives me this error:

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

invoke-rc.d: initscript nginx, action "start" failed.

● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-05-10 15:42:16 -03; 32ms ago
Docs: man:nginx(8)
Process: 14383 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Process: 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() to [::]:80 failed (98: Address already in use)
may 10 15:42:15 hatshep-Lenovo-ideapad-310-14IKB nginx[14383]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
may 10 15:42:15 hatshep-Lenovo-ideapad-310-14IKB nginx[14383]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
may 10 15:42:15 hatshep-Lenovo-ideapad-310-14IKB nginx[14383]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
may 10 15:42:15 hatshep-Lenovo-ideapad-310-14IKB nginx[14383]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
may 10 15:42:16 hatshep-Lenovo-ideapad-310-14IKB nginx[14383]: nginx: [emerg] still could not bind()
may 10 15:42:16 hatshep-Lenovo-ideapad-310-14IKB systemd[1]: nginx.service: Control process exited, code=exited status=1
may 10 15:42:16 hatshep-Lenovo-ideapad-310-14IKB systemd[1]: Failed to start A high performance web server and a reverse proxy server.
may 10 15:42:16 hatshep-Lenovo-ideapad-310-14IKB systemd[1]: nginx.service: Unit entered failed state.
may 10 15:42:16 hatshep-Lenovo-ideapad-310-14IKB systemd[1]: nginx.service: Failed with result 'exit-code'.

hackela
  • 353
  • 1
  • 9
frtgu34
  • 99
  • 9
  • Can you post the exact commands you are running are results of the "journalctl -xe" debug command ? – hackela May 10 '18 at 19:08
  • first valet install; i got the same error with sudo apt install nginx – frtgu34 May 10 '18 at 19:11
  • I can install, only I need stop apache2!! – frtgu34 May 10 '18 at 19:20
  • Yes it seems like this install needs to stop some processes first. Did you check any tutorial like that: https://www.phusionpassenger.com/library/install/nginx/install/oss/zesty/ – hackela May 10 '18 at 19:21

2 Answers2

1

By default, nginx is configured to listen on port 80.

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

This error message tells you, that nginx cannot listen on port 80, because some other program is already listening on that port. This might be another webserver, for example apache.

You can find out which program is listening on port 80 using netstat

netstat -tulpn | grep ':80'

To start nginx, you either have to stop that program, or configure nginx so that it listens on a different port.

If the other program is apache, you can stop it with the following command:

systemctl stop apache2
david
  • 623
  • 5
  • 13
0

I can install valet, only I need stop apache2!!

frtgu34
  • 99
  • 9