Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > How to change the directory that Apache hosts?

How to change the directory that Apache hosts?
Thread Tools
Dedicated MacNNer
Join Date: May 2001
Location: Atlanta, GA
Status: Offline
Reply With Quote
Apr 1, 2003, 09:09 PM
 
Is it possible to change the directory that apache hosts to a user's home directory rather than their ~/Sites folder?

I'd like to do so, and have spent the entire day looking for a definitive answer, and haven't found it just yet. Also, I've been using authentication with my Sites folder and would like to continue doing so. I used that program called Weblock to do it, although I do have some experience tinkering with those files in the past. I know that Weblock changes two files...

1 - the /etc/httpd/httpd.conf file...which I think that those changes would not have to be changed when changing the hosting directory.

2 - the /etc/httpd/users/username.conf file. In the documentation it says that this change is so that the ~/Sites/ folder can protected. Would this also allow the user's home directory to be protected, or would a different change be necessary?

I guess my main question is how exactly (if possible) to change the directory that apache hosts, and if so, will the changes I have made to those files still be valid to protect the folders in my home directory?

Thanks in advance for the help, I really appreciate it!
     
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Apr 2, 2003, 07:29 AM
 
Here's the answer:

Change the directive
UserDir Sites
in /etc/httpd/httpd.conf

to UserDir FolderYouWant

Note, however, that you envision accessing all your files (Documents, Pictures, etc.) that way, it won't work.
The web server runs as user 'www'. The permissions in your home folder allow other users, like 'www', to access the Sites folder, and to see the contents of your home folder, but not of the subfolders (like Documents, Pictures, Movies, etc.)


If you really want complete access to your files via the webserver, you'll want to run a separate copy of Apache that runs as you, instead of www. This is definitely a security risk, but it's doable.

If you want to do this, do this:
1. Copy the file /etc/httpd/httpd.conf to somewhere in your home folder, e.g. in Library.
2. Edit that file, and change every single reference to a system-wide folder (like /var/log/httpd) to somewhere in your own home folder (e.g. /Users/yourname/Library).
3. Change the port that this Apache runs on from 80 to something else, like 8080. (That's the 'Port' directive)
4. When you're all done, go to the Terminal and type:
httpd -f /Users/yourname/Library/httpd.conf

If you made all the changes correctly, it will work.

You can see this article for a brief mention of a similar change.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:12 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2