General Question

richardhenry's avatar

How do I make http://localhost/ point at my Sites folder?

Asked by richardhenry (12641points) July 30th, 2008

I had this setup before, but just reinstalled OS X. Does anyone know the best way to do this? I’ve Googled around and can’t find the article I originally read.

Observing members: 0 Composing members: 0

7 Answers

robmandu's avatar

Not on my Mac right now… but did you try File > Open… and then navigate to the local directory?

richardhenry's avatar

Sorry, I should have clarified. Apache2 has been started, and navigating to http://localhost/ in the web browser currently draws on the contents of /Library/WebServer/Documents, as it should do. I want it to draw from my ~/Sites/ folder.

robmandu's avatar


you could either…

0. Find the definition for DocumentRoot in the httpd.conf and modify that.

- or -

1. employ a symlink in the /Library/WebServer/Documents that points to your ~/Sites folder.

- or -

2. modify the httpd.conf file to define an alias to your ~/Sites directory.

[ Disclaimer ]: I’m attacking this from a standard non-OS-dependent angle. There’s a possibility that Apple has provided a system pref to handle this for you, but I’m not currently aware of it.

chaosrob's avatar

Cheap & cheesy fix: Open /etc/apache2/httpd.conf, change line 163 from DocumentRoot ”/Library/WebServer/Documents” to DocumentRoot ”/Users/xxmexx/Sites” and restart the Web Sharing. Also change line 190 to the new path.

robmandu's avatar

chaosrob provides the actual details that I alluded to in option 1 above. Nice!

robmandu's avatar

grrr… [edit] ...alluded to in option 0 above.

richardhenry's avatar

I completely forgot that Apache honors symlinks. I was thinking about a hard link but it’s messy. Created one and it works just fine. Cheers guys. :D

Answer this question




to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
Knowledge Networking @ Fluther