Forum Moderators: phranque

Message Too Old, No Replies

Problem setting up virtual hosts in Apache

Document root does not exist (CentOS)

         

gcan

11:41 am on Sep 1, 2008 (gmt 0)

10+ Year Member



I just got a new CentOS server and have problems with setting up virtual Hosts. Apache reports that document root doesn't exist, but it exists.

========================

1. I created user "testuser"

2. I created virtualhost

<VirtualHost *:80>
DocumentRoot /home/testuser/mysite-com
ServerName www.mysite.com
ServerAlias mysite.com *.mysite.com
<Directory /home/testuser/mysite-com>
Options -Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All
</Directory>
</VirtualHost>

3. I created file index.html in folder "mysite-com".

4. Permissions:

drwxr-xr-x 3 root root 4096 Sep 1 15:48 home
drwx--x--x 3 testuser testuser 4096 Sep 1 16:43 testuser
drwxr-xr-x 2 testuser testuser 4096 Sep 1 16:51 mysite-com
-rwxr-xr-x 1 testuser testuser 6 Sep 1 16:51 index.html

5. I restarted Apache

6. Result:
Stopping httpd: [ OK ]
Starting httpd: Warning: DocumentRoot [/home/testuser/mysite-com] does not exist
[ OK ]

5. /var/log/httpd/error_log file shows:
$
[Mon Sep 01 17:38:54 2008] [error] [client 111.111.111.111] (13)Permission denied: $

==============================

I tried to change DocumentRoot to:
/home/testuser
and also created index.html in this folder.
In this case Apache shows default Apache Test page instead of showing index.html file from "testuser" folder.

==============================

Can anyone help to solve this problem?
Thanks.

vincevincevince

12:02 pm on Sep 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1) Try putting a trailing / on the document root
2) CHOWN or CHGRP the document root and its immediate parent to whatever Apache runs at
3) Finally, try to CHMOD the directory to 777 (not a good idea; but it will work)

gcan

12:18 pm on Sep 1, 2008 (gmt 0)

10+ Year Member



vincevincevince, thank you for answer.
I added trailing slash to the cocument root - no success
I chowned apache:apache document root and it's parent - no success
I chmoded document to 777 - no success.

Still the same error:

Starting httpd: Warning: DocumentRoot [/home/testuser/mysite-com] does not exist

:(

gcan

1:37 pm on Sep 1, 2008 (gmt 0)

10+ Year Member



I just changed DocumentRoot to /var/www/html/mysite-com and everything works fine. So, I'll put my files in that folder.