How do I make http://localhost/ point at my Sites folder?
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
Not on my Mac right now… but did you try File > Open… and then navigate to the local directory?
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.
ah
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.
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.
chaosrob provides the actual details that I alluded to in option 1 above. Nice!
grrr… [edit] ...alluded to in option 0 above.
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
This question is in the General Section. Responses must be helpful and on-topic.