UPDATE: The following answer will also work for El Capitan.
For people who just start, the file mentioned below is under /etc/apache2
For th
Resuming for El Captain, with users support:
sudo nano /private/etc/apache2/users/username.conf
Options Indexes MultiViews FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from localhost
Require all granted
sudo nano /etc/apache2/httpd.conf, uncomment:
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule cgi_module libexec/apache2/mod_cgi.so
LoadModule php5_module libexec/apache2/libphp5.so
Include /private/etc/apache2/extra/httpd-userdir.conf
sudo nano /etc/apache2/extra/httpd-userdir.conf, uncomment:
Include /private/etc/apache2/users/*.conf
apachectl configtest
Taken from here.