You should now be able to direct your browser to ‘localhost’ or ‘127.0.0.1’ and see in the browser ‘ it works!’. The default Apache configuration reads from
/Library/WebServer/Documents/index.html.en
Apple recommends to create a directory ‘Sites’ in your home account and run your local user website from there. First, create the directory for the website in your home directory
mkdir ~/Sites
echo '
It works locally too!
' > ~/Sites/index.html
Next, navigate to the apache user configuration directory
cd /etc/apache2/users
where you should see a file with your user name ending with ‘.conf’.
<Directory "/Users/developer/Sites/">
Options Indexes MultiViews
Require all granted
</Directory>
Modify it to
<Directory "/Users/developer/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
Navigate to the parent directory, and make a backup of the original ‘https.conf’ file.
cd /etc/apache2
sudo cp httpd.conf httpd.conf.bak
cd /etc/apache2/extra
sudo cp httpd-userdir.conf httpd-userdir.conf.bak
Edit the file
/etc/apache2/extra/httpd-userdir.conf
and uncomment line 16
# Settings for user home directories
#
# Required module: mod_authz_core, mod_authz_host, mod_userdir
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received. Note that you must also set
# the default access control for these directories, as in the example below.
#
UserDir Sites
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
#Include /private/etc/apache2/users/*.conf
<IfModule bonjour_module>
RegisterUserSite customized-users
</IfModule>
Thanks for putting this together. It helped me out big time. I’m used to doing this on Linux, but never did it on a Mac before. Your guide helped me out. Thanks again.
Thanks for putting this together. It helped me out big time. I’m used to doing this on Linux, but never did it on a Mac before. Your guide helped me out. Thanks again.