Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuongnmx/e2908fe404e5086630c5b37d94343844 to your computer and use it in GitHub Desktop.
Save cuongnmx/e2908fe404e5086630c5b37d94343844 to your computer and use it in GitHub Desktop.
Enabling WebSharing on OSX 10.10 (Yosemite)

the horror!

The jist of starting and stoping apache:

$ sudo apachectl start
$ sudo apachectl stop
$ sudo apachectl restart

if you care about the HTTPD version

$ httpd -v
Server version: Apache/2.4.9 (Unix)
Server built:   <Date>

http://localhost/ is stored at /Library/WebServer/Documents/

but I like to run my work from under my user directory, e.g., ~/Sites folder. Which requires some more configuration, see below:

Add <username>.conf under /etc/apache2/users/

Add the following to <username>.conf:

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

The correct permission is 644 and root/wheel should be the owner/group.

$ sudo chmod 644 <username>.conf

Uncomment the following in /etc/apache2/httpd.conf:

LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule userdir_module libexec/apache2/mod_userdir.so

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

Lastly, uncomment the following in /etc/apache2/extra/httpd-userdir.conf:

Include /private/etc/apache2/users/*.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment