Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 02-06-2005, 11:51 PM   #1
LQ Newbie
Registered: Feb 2005
Posts: 6

Rep: Reputation: 0
Apache 2 VirtualHost woes, permissions problem, just can't work it out.

Hi all.

I've been working on this for hours and haven't got it work yet. I wanted to create a VirtualHost with a DocumentRoot that points to a directory in a user account. The idea is that user can SMB in and simply plop the files into their directory to get them hosted. (it's for my wife, the easier the better)

My initial attempt at a VirtualHost...

DocumentRoot /home/user/www
ErrorLog logs/
CustomLog logs/ common

...but restarting httpd results in the following Warning....

Starting httpd: Warning: DocumentRoot [/home/user/www] does not exist

...I know this is a permissions problem. I've tried everything I can think of. I added the apache user to my user's group, adding/changing permissions, etc... No luck. Any suggestions?

Secondly, I attempted a VirtualHost with a Directory defined. See the following...

DocumentRoot /
ErrorLog logs/
CustomLog logs/ common
<Directory "/home/user/www">
AllowOverride None
Options None
Order allow,deny
Allow from all

This doesn't make Apache throw a warning, BUT I can't access anything in /home/user/www/, I get a HTTP 404 error in my browser. (object not found)

You now basically know what I'm trying to accomplish, if either VirtualHost approach is a waste of time when trying to host from a user's home, let me know if it's possible.

If I can sort this out, it's on to printer sharing. ;-)


- utow
Old 04-19-2005, 02:12 PM   #2
LQ Newbie
Registered: Apr 2005
Posts: 1

Rep: Reputation: 0
Starting httpd: Warning: DocumentRoot [/home/user/www] does not exist

Your are getting this because.....................

1. your server might be running SELinux. (Security Enhanced Linux) on top of your OS. ie: Fedora Core 3 and RHEL 4 comes with this.

Do This:

ls -Z /home/user/www/

if the out put is:

drwxr-xr-x root root rootbject_r:user_home_t www
or something similar...

Then we've got a problem.... as apache has no rights into those folders since SElinux has placed contect labels on those folders where apache will have no access to.

So now, we do this to tell SELinux on your server that these folders will inherit httpd content.

chcon -R -h -t httpd_sys_content_t /home/user/www

You can also try chcon -R -h -t httpd_sys_content_t /home/user

But nevertheless, once youve dont this, for any new folders or files you place into that folder, it will inherit the rules.

restart your apache....everything should be ok.

Old 04-19-2005, 02:48 PM   #3
LQ Newbie
Registered: Apr 2005
Location: Berlin, Germany
Distribution: Debian 2.6.10
Posts: 6

Rep: Reputation: 0
What version of Apache are you using? I remember there was a problem with includes etc. that point to another partition. But this must have been in the 1.x-times. I used to have this problem on a OpenBSD with Apache 1.4 I guess.

[edit]Sorry, forget about that. Now is see, you mentioned the version in the title [/edit]

Last edited by metobln; 04-19-2005 at 03:22 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting 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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache -VirtualHost davidhk Debian 7 08-19-2005 01:33 PM
Apache VirtualHost Redirect Problem... SiLiCoN Linux - Networking 5 05-03-2005 09:41 AM
Apache - Problem when configure VirtualHost b:z Linux - Networking 17 04-07-2005 03:44 AM
VirtualHost Apache 2 Problem Chris_K1 Linux - Networking 0 01-25-2005 11:00 AM
Apache: Virtualhost configuration problem deepika Linux - Software 3 08-12-2003 11:13 AM

All times are GMT -5. The time now is 06:54 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration