LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-04-2010, 05:14 PM   #1
ajb1967
LQ Newbie
 
Registered: Aug 2010
Location: Bristol, UK
Distribution: CentOS 5 with Plesk 9
Posts: 2

Rep: Reputation: 0
Apache Virtual Host doesnt serve files from correct directories


I am trying to configure a virtual host in my httpd.conf file however, when i enter the url into my FF browser, I am getting the website from the main server and not the virtual server I have defined.

Here are the relevant entries in httpd.conf
~~~~~~~~~~~~~~~~~~~

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.s15390539.onlinehome-server.info
ServerAlias s15390539.onlinehome-server.info
DocumentRoot /var/www/vhosts/default/htdocs/
DirectoryIndex index.php index.html

<Directory "/var/www/vhosts/default/htdocs">
Allow from all
AllowOverride All
Order allow,deny
</Directory>

ServerAdmin andyburrows@yahoo.com

ErrorLog /etc/httpd/logs/s15390539.onlinehome-server.info/error_log
CustomLog /etc/httpd/logs/s15390539.onlinehome-server.info/access_log common

SetEnv SITE_ROOT /var/www/vhosts/default/htdocs
SetEnv SITE_HTMLROOT /var/www/vhosts/default/htdocs

</VirtualHost>

<VirtualHost *:80>
ServerName www.staging.matthewarnold.rakatatech.co.uk
ServerAlias staging.matthewarnold.rakatatech.co.uk
DocumentRoot /var/www/vhosts/default/htdocs/staging/matthewarnold/
DirectoryIndex index.php index.html

<Directory "/var/www/vhosts/default/htdocs/staging/matthewarnold">
Allow from all
AllowOverride All
Order allow,deny
</Directory>

ServerAdmin andyburrows@yahoo.com

ErrorLog /etc/httpd/logs/staging.matthewarnold.rakatatech.co.uk/error_log
CustomLog /etc/httpd/logs/staging.matthewarnold.rakatatech.co.uk/access_log common

SetEnv SITE_ROOT /var/www/vhosts/default/htdocs/staging/matthewarnold
SetEnv SITE_HTMLROOT /var/www/vhosts/default/htdocs/staging/matthewarnold

</VirtualHost>

~~~~~~~~~~~~ EOF ~~~~~~~~~~~~~~~~~

Instead of the website (that can be seen from http://s15390539.onlinehome-server.i...matthewarnold/) being served from /var/www/vhosts/default/htdocs/staging/matthewarnold when I enter www.staging.matthewarnold.rakatatech.co.uk, i am getting the website that is installed in /var/www/vhosts/default/htdocs

Any pointers would be appreciated.

Cheers,
Andy
 
Old 08-04-2010, 05:38 PM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780
Off hand, I don't see anything obviously wrong with your configuration. Stupid question, but did you reload apache after creating the second host?

Comparing your configuration to mine, which is running multiple hosts, I noticed a couple of differences that you may want to investigate.
1 - my document root do not end in a /
2 - in my <directory> blocks, I have the following: Options Indexes FollowSymLinks MultiViews
3 - in each vhost I have the following directory root definitions in addition to the <directory> block for the files:

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

4 - my order in the directory blocks of the access controls is a little different. I don't know if the order makes a difference or not, but if it is like IP tables and uses a waterfall rule approach it might. I would think that if this were a problem you would get a forbidden error, though. Mine looks like this:

AllowOverride all
Order allow,deny
allow from all
 
Old 08-05-2010, 03:48 AM   #3
ajb1967
LQ Newbie
 
Registered: Aug 2010
Location: Bristol, UK
Distribution: CentOS 5 with Plesk 9
Posts: 2

Original Poster
Rep: Reputation: 0
Hi Noway2 - THanks for your reply

Yes, I perform a
Code:
service httpd restart
after every httpd.conf change

Quote:
1 - my document root do not end in a /
AJB>> I have removed my trailing /

Quote:
2 - in my <directory> blocks, I have the following: Options Indexes FollowSymLinks MultiViews
AJB>> I have added the same to my directory blocks

Quote:
3 - in each vhost I have the following directory root definitions in addition to the <directory> block for the files:

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
AJB>> I have added the same to each vhost declaration

Quote:
4 - my order in the directory blocks of the access controls is a little different. I don't know if the order makes a difference or not, but if it is like IP tables and uses a waterfall rule approach it might. I would think that if this were a problem you would get a forbidden error, though. Mine looks like this:

AllowOverride all
Order allow,deny
allow from all
AJB>> I've changed the order to match yours.

Still no Joy
 
Old 08-05-2010, 04:55 AM   #4
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780Reputation: 780
I'm sorry that didn't help. Time to dig deeper.

Not sure if it will provide any clues or not, but take a look at apache's access.log. It should be located with the other system logs. Try accessing each vhost and compare the results. Take a look at error.log too, just in case.

In access.log you should see data like this:
Quote:
::1 - - [25/Jul/2010:08:09:42 -0400] "POST /newpage/viewcart.php HTTP/1.1" 200 2208 "http://localhost/newpage/viewcart.php" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6"
Giving the IP (possibly in v6 format, but not always), the response code (200 in this case, and the URL that was attempted access. I suspect either you are going to see an error code or the wrong URL and this should help to isolate the problem.

Lastly, do another restart and look at the results in your apache.log and syslog. Sometimes a configuration error will show up there that doesn't result in a message being displayed during the restart.
 
  


Reply


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 2.2 Virtual Hosts won't serve index.html lspiehler Linux - Server 4 08-11-2011 04:27 AM
Running out of space creating Virtual Machines OES2 sp1 on SUSE 10 SP2 Xen host serve tekygirl SUSE / openSUSE 2 03-18-2009 01:43 PM
my defaul virtual host doesnt work laeeq38 Linux - Newbie 1 07-21-2006 06:50 PM
Apache Server won't serve up large files perrond Linux - Networking 4 06-21-2004 10:53 AM
How do I get Apache to serve the right docs from the right directories? gomer1701ems Linux - Software 1 06-11-2001 09:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:23 AM.

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