Back to Forum
How to Setup Apache 2.4.48 On MacOS Monterey
chris posted 5 years ago

Tutorial to be transferred to blog post.

Starts with Apache version 2.4.48

Linux Directories Demystified:

  1. /bin – Binaries — should be /binaries

  2. /boot – Boot Files — should be /boot-files

  3. /etc – Configuration Files — should be /configuration-files

  4. /home – Users’ Folder — /home actually works here

  5. /lib – Libraries — should be /libraries

  6. /usr – User Binaries — should be /user-binaries

  7. /var – Variable Files — should be /variable-files

Crazy that we use abstractions for words as short as "binaries." Abstractions such as /usr for "User Binaries" are incredibly unhelpful.

When you install a program, where does it go?

On Mac, the program is stored in an individual folder inside /Applications.

What is a binary?

An executable file compiled from source code to machine code.

If Mac apps are stored in /Applications, what are the apps inside /usr (user-binaries)?

These are mostly command line / linux related apps such as ssh-keygen.

What is the libexec folder supposed to contain?

Executable machine code used by other programs.

The process:

1. Keep your docroot as the default /Library/WebServer/Documents, changing this will give you permission issues with a 403 error.

2. Add the option Indexes to the docroot XML tag to allow Apache to list out all websites located within the directory. It should look like this:

DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Multiviews
    MultiviewsMatch Any

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

3. Install PHP with:

brew install php
Note, you may have to run xcode-select --install prior for this php install to work.

Additional note, you'll need to upgrade your version of Xcode to 13.0 or higher for this to work, you can download directly from https://developer.apple.com/download/all/.

4. Add index.php as an option prior to index.html so apache will look for PHP files first:

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

Seeming impossible, I've made a switch to Docker to try and run an Ubuntu image off MacOS. So far, setup has been frustrating and difficult.

Setup Docker and access a container via command line:

  1. docker pull ubuntu or docker pull ubuntu:18.04

  2. docker start container_name

  3. docker attach container_name

Docker also doesn't allow you to use apt-get update with success. Program seems quite unintuitive, and all answers on Google are unhelpful.

Switch to MAMP...

Want to participate?

Create a free Chris Courses account to begin

Providing the lift to launch your development career

© 2026 Chris Courses. All rights reserved.