Creating a local web-server on MacOS Big Sur

Start the builtin Apache server

					sudo apachectl start				

You should now be able to direct your browser to ‘localhost’ or ‘’ and see in the browser ‘ it works!’. The default Apache configuration reads from


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

Modify it to

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

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


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

Next, edit the file


and uncomment line 113

					#LoadModule include_module libexec/apache2/				

lines 186 and 187

					#LoadModule rewrite_module libexec/apache2/
#LoadModule php7_module libexec/apache2/				

lines 524

					#Include /private/etc/apache2/extra/httpd-userdir.conf				

and line 555 (the last line)

					#Include /private/etc/apache2/other/*.conf				

Make sure the following lines are also uncommented

					LoadModule authn_core_module libexec/apache2/
LoadModule authz_host_module libexec/apache2/
LoadModule userdir_module libexec/apache2/
LoadModule rewrite_module libexec/apache2/				

Finally, restart the apache server

					sudo apachectl restart				

Test the configuration by pointing the browser to you local user site


where ‘username’ is your account name. The account name can found by the command


Leave a Reply

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

Scroll to Top