LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Apache 2 VirtualHost woes, permissions problem, just can't work it out. (http://www.linuxquestions.org/questions/linux-software-2/apache-2-virtualhost-woes-permissions-problem-just-cant-work-it-out-287117/)

utow 02-06-2005 11:51 PM

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...

<VirtualHost user.hostname.ca:443>
ServerAdmin webmaster@user.hostname.ca
DocumentRoot /home/user/www
ServerName user.hostname.ca:443
ServerAlias wwwuser.hostname.ca
ErrorLog logs/user.hostname.ca-error_log
CustomLog logs/user.hostname.ca-access_log common
</VirtualHost>

...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...

<VirtualHost user.hostname.ca:443>
ServerAdmin webmaster@user.hostname.ca
DocumentRoot /
ServerName user.hostname.ca:443
ServerAlias www.user.hostname.ca
ErrorLog logs/user.hostname.ca-error_log
CustomLog logs/user.hostname.ca-access_log common
<Directory "/home/user/www">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

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. ;-)

Thanks!!!

- utow

komni 04-19-2005 02:12 PM

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 root:object_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.


Kevin
Komni.com

metobln 04-19-2005 02:48 PM

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 :cool: [/edit]


All times are GMT -5. The time now is 01:52 AM.