How to test the brew instance of Apache

By | August 2, 2020

If you are looking to work with Apache on OSX you have probably been advised to not use the Apache 2.4 pre-installed version because Apple has removed some required scripts, especially in the macOS 10.15 Catalina release.

Here are the commands to run to install Apache via brew.

First shutdown Apache and unload any scripts.

$ sudo apachectl stop
$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null

The install httpd with brew.

brew install httpd

Then start Apache again with:

sudo apachectl start

To watch the log files:

tail -f /usr/local/var/log/httpd/error_log

Now here is the interesting part. You need to know where to find the httpd.conf file because this file determines various key settings such as port number and ip address among other things.

httpd.conf

usr/local/etc/httpd/httpd.conf //brew
private/etc/apache2/httpd.conf //osx default

web server root dir

usr/local/var/www //brew
Library/WebServer/Documents //osx default

Category: OSX

Leave a Reply

Your email address will not be published. Required fields are marked *