Why doesn't homebrew apache start at startup?

Viewed 4237

I’m trying to figure out why my apache doesn’t start at startup… (I would like for it to).

My OS: OSX Mojave

Impressions I’m under: that I’m running homebrew’s apache

Upon a fresh boot…

If I hit http://localhost in a browser I get

Unable to connect

Firefox can’t establish a connection to the server at localhost.

Fire up terminal…

$brew services list

returns

httpd started bigpimpin /Users/bigpimpin/Library/LaunchAgents/homebrew.mxcl.httpd.plist

php   started bigpimpin /Users/bigpimpin/Library/LaunchAgents/homebrew.mxcl.php.plist

(That first line makes me think httpd is running and I should be able to hit localhost).

$which -a apachectl

returns

/usr/local/bin/apachectl
/usr/sbin/apachectl

then

$apachectl configtest

returns

Syntax OK

then

$sudo apachectl -V

returns (among other things)

-D SERVER_CONFIG_FILE="/usr/local/etc/httpd/httpd.conf"

(Isn’t this brew’s httpd.conf?)

There's a brew command (which I forget) that I already ran that is supposed to run httpd at startup.

Once I run

$sudo apachectl start

everything is jake. So it’s a low-priority question, but one I would like to solve and understand.

1 Answers

I had the same issue with Homebrew NGINX. Running the brew services command with sudo solved the problem for me.

It appears that the Homebrew web-server packages require sudo to start | stop | restart.

Try running:

sudo brew services start apache2

Related