Apache/Nginx configuration issue after uninstalling laravel/valet and homestead on macOS Sierra

895 views Asked by At

After uninstalling laravel/valet and Homestead on macOS Sierra, I switched back to Apache (rather than NGINX), tried to restart it using sudo apachectl -k restart, and it outputs this error:

httpd not running, trying to start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs

Additional Info - using Homebrew 1.3.1 with OS Sierra 10.12.6. Also used a similar local environment to the one found here: https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions

Disclaimer: I almost never use NGINX but I'm assuming it, or something else involved in the laravel/valet setup is preventing Apache from binding to the right port.

How do I fix this error and reconfigure Apache to work with Homebrew again, instead of NGINX?

No output from lsof -i | grep LISTEN | grep ":80" but the output of sudo lsof -i :80 below:

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
httpd   12146 root    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
httpd   12148 _www    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
httpd   37113 _www    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
httpd   37114 _www    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
httpd   37115 _www    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
httpd   38654 _www    4u  IPv6 0x3f591ee6220c2a09      0t0  TCP *:http (LISTEN)
1

There are 1 answers

5
Tarun Lalwani On BEST ANSWER

First check if nginx is running

ps aux | grep nginx

If it is running then check if it is running using brew

brew services list

If that shows nginx started then you use below command to stop it

brew services stop nginx

If it is not listed as started or not listed as a service then try to manually kill nginx

pkill nginx

Now to try to restart apache

sudo apachectl restart