How to Setup the Builtin Local macOS Apache Server

Apache Configuration

Apache Main Configuration

File Information

File Contents

Uncomment Lines
LoadModule authz_core_module
libexec/apache2/mod_authz_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule php7_module libexec/apache2/libphp7.so
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
Include /private/etc/apache2/extra/httpd-vhosts.conf

Changes

Change AllowOverride none at …

<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 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>

… to AllowOverride All.

Optional

Change …

User _www
Group _www

… to your Unix user name and group.

Nota Bene: If you don’t add this optional change, you need to make sure all web directories are assigned to the user and group above and their permissions are set accordingly.

Apache Virtual Hosts

File Information

File Contents

Add virtual hosts entries in the form of …

<VirtualHost *:80>
    ServerAdmin moritz@zimmer.partners
    DocumentRoot "/Users/Sites/zimmer.partners"
    ServerName zimmer.local
    ServerAlias www.zimmer.local
    ErrorLog "/private/var/log/apache2/zimmer.local-error_log"
    CustomLog "/private/var/log/apache2/zimmer.local-access_log"
common
</VirtualHost>

Don’t forget to add corresponding entries to /etc/hosts in the form of …

127.0.0.1           zimmer.local

User Configuration

Apache Main Configuration

File Information

File Contents

Uncomment Lines
LoadModule userdir_module
libexec/apache2/mod_userdir.so
Include /private/etc/apache2/extra/httpd-userdir.conf

Apache User Directory Configuration

File Information

File Contents

Uncomment Lines
Include /private/etc/apache2/users/*.conf

Apache User Configuration

File Information

File Contents

<Directory "/Users/username/Sites/">
    AllowOverride All
    Options Indexes MultiViews FollowSymLinks
    Require all granted
</Directory>

Permissions

Credits

… go to …
http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/

License

Creative Commons Zero (CC0)