Skip to content

Instantly share code, notes, and snippets.

@clintliang
Last active May 17, 2017 19:34
Show Gist options
  • Save clintliang/0e9884883c665d17d256384758198677 to your computer and use it in GitHub Desktop.
Save clintliang/0e9884883c665d17d256384758198677 to your computer and use it in GitHub Desktop.

Configure Apache Server on MacOS Sierra

Apache is installed by default, here's how to configure it.

configure vhosts

vi /etc/apache2/httpd.conf

Add the following line

Include /private/etc/apache2/vhosts/*.conf

Create vhosts folder

mkdir /etc/apache2/vhosts

create your local site config

vi /etc/apache2/vhosts/mysite.conf

Configure user level root

sudo vi /etc/apache2/httpd.conf

Add the following line

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

Edit httpd-userdir.conf

sudo vi /etc/apache2/extra/httpd-userdir.conf

Add the following line

Include /private/etc/apache2/users/*.conf
sudo mkdir /etc/apache2/users
sudo vi /etc/apache2/users/myusername.conf

Add the following configuration to myusername.conf

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

Restart Apache

sudo apachectl configtest
sudo apachectl restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment