Adding Sites Folder to Mountain Lion

If you have upgraded or bought a new Mac(like I did) you will notice that your Sites folder is gone, along with the web sharing in the control panel. I guess Apple wants us just to use the local host located at Library/WebServer/Documents and not the Sites folder in the user folder, which is really a virtual host.

[box type=”info”] You will notice Web Sharing is Gone from Services[/box]

There is a easy fix to both getting the sites folder back, and using the local webser sever!

First create a folder in your home directory called “Sites”

Now open Terminal (I use Text Mate) , terminal is located in Applications/Utilities/terminal

go to /etc/apache2/users here you will most likely not find your-username.conf file, so lets create one.

type pico(to create a file) call it your_username.conf, mine would be johnbarrett.conf for exampe.
Inside the file put this. I actually just copied  and pasted from the Guest.conf and saved it as my-username.conf

save the file(control +o), now give the file full permission:

[box] chmod 777 your-username.conf[/box]
Now you can view your site at
[box] http://localhost/~username/[/box]

Now Lets Get Apache Working
to start it
[box] sudo apachectl start[/box]

to stop it
[box] sudo apachectl stop[/box]

to restart it
[box] sudo apachectl restart[/box]

Now remember anytime you make changes to any conf files you must restart apache.

Leave a Reply