Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

Virtual Host Performance Oddity

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


lists at jaqui-greenlees

Dec 31, 2008, 1:31 AM

Post #1 of 6 (384 views)
Permalink
Virtual Host Performance Oddity

Running Apache 2.2.8 [. Mandriva 2008.1 default build with php5, mod_perl
and mod_python over base install ]
I set up 3 vhosts, using name based vhosts.
all 3 work but the 3rd one has a response time of over 5 minutes. This
is just loading a basic html page, so the php, perl and python support
shouldn't be an issue.
The other two vhosts load and display the correct page instantly.

I added them one at a time and tested, when the first one worked I
copied the container and edited it to meet the needs of the second,
tested then repeated for the third.


Does anyone have any idea what would cause the 3rd vhost to take so long
to respond?
here is the vhost conf currently in use:

<VirtualHost *:80>
ServerAdmin
DocumentRoot /home/jaqui/public_html
ServerName dev.runic-hosting.com
ErrorLog /var/log/httpd/dev.runic-hosting.com-error_log
CustomLog /var/log/httpd/dev.runic-hosting.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin
DocumentRoot /home/dawnfyre/public_html
ServerName dev.jaqui-greenlees.net
ErrorLog /var/log/httpd/dev.jaqui-greenlees.net-error_log
CustomLog /var/log/httpd/dev.jaqui-greenlees.net-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin
DocumentRoot /home/shawan/public_html
ServerName dev.shawanspage.com
ErrorLog /var/log/httpd/dev.shawanspage.com-error_log
CustomLog /var/log/httpd/dev.shawanspage.com-access_log common
</VirtualHost>

This is a testing system, so it's not a critical issue as in harming
production system(s)
The email addresses removed to avoid spambots getting them.

The error logs only show:
Request exceeded the limit of 10 internal redirects due to probable
configuration error. Use 'LimitInternalRecursion' to increase the limit
if necessary. Use 'LogLevel debug' to get a backtrace.
for the default vhost, the other 2 vhosts have empty error logs.

Jaqui



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


aw at ice-sa

Dec 31, 2008, 2:59 AM

Post #2 of 6 (328 views)
Permalink
Re: Virtual Host Performance Oddity [In reply to]

J. Greenlees wrote:
> Running Apache 2.2.8 [. Mandriva 2008.1 default build with php5, mod_perl
> and mod_python over base install ]
> I set up 3 vhosts, using name based vhosts.
> all 3 work but the 3rd one has a response time of over 5 minutes. This
> is just loading a basic html page, so the php, perl and python support
> shouldn't be an issue.
> The other two vhosts load and display the correct page instantly.
>
> I added them one at a time and tested, when the first one worked I
> copied the container and edited it to meet the needs of the second,
> tested then repeated for the third.
>
>
> Does anyone have any idea what would cause the 3rd vhost to take so long
> to respond?
> here is the vhost conf currently in use:
>
> <VirtualHost *:80>
> ServerAdmin
> DocumentRoot /home/jaqui/public_html
> ServerName dev.runic-hosting.com
> ErrorLog /var/log/httpd/dev.runic-hosting.com-error_log
> CustomLog /var/log/httpd/dev.runic-hosting.com-access_log common
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerAdmin
> DocumentRoot /home/dawnfyre/public_html
> ServerName dev.jaqui-greenlees.net
> ErrorLog /var/log/httpd/dev.jaqui-greenlees.net-error_log
> CustomLog /var/log/httpd/dev.jaqui-greenlees.net-access_log common
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerAdmin
> DocumentRoot /home/shawan/public_html
> ServerName dev.shawanspage.com
> ErrorLog /var/log/httpd/dev.shawanspage.com-error_log
> CustomLog /var/log/httpd/dev.shawanspage.com-access_log common
> </VirtualHost>
>
> This is a testing system, so it's not a critical issue as in harming
> production system(s)
> The email addresses removed to avoid spambots getting them.
>
> The error logs only show:
> Request exceeded the limit of 10 internal redirects due to probable
> configuration error. Use 'LimitInternalRecursion' to increase the limit
> if necessary. Use 'LogLevel debug' to get a backtrace.
> for the default vhost, the other 2 vhosts have empty error logs.
>
Hi.

If it wasn't for the error message in the log, I would tell you to first
look at your DNS configuration, and check how that hostname
"dev.shawanspage.com" is being resolved. If you have two DNS servers
configured, and the first one for some reason is not answering, then
your local resolver will first wait for an answer from the first one,
time out, then try the second one. That could be your delay.

Second, remember that the first Vhost is the default Vhost. That means
that when any request somehow arrives to your server, if the server
cannot match the "Host:" header in the request, with one of your VHost
"ServerName" lines, it will process the request using the first defined
VHost, no matter what its own "ServerName" line says.

But then there is the error log.
Because the message occurs in the log of the default VHost, it seems to
indicate that the request did not match the ServerName of your third
VHost, and was thus processed by the default host.
Which is strange on the face of it.
But the error message also indicates some kind of loop. As if the
request did arrive and was first processed by the 3rd VHost, which
re-directed it to the same IP, but with a wrong "Host:" header, which
caused the redirected request to be handled by the default VHost, which
itself re-directed it and so on.
Do you by any chance, in these VHosts, have .htaccess files in the
DocumentRoot that would do some kind of re-direct ?
Or is there some part of the configuration that you are not showing us ?


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


lists at jaqui-greenlees

Dec 31, 2008, 3:37 AM

Post #3 of 6 (328 views)
Permalink
Re: Virtual Host Performance Oddity [In reply to]

André Warnier wrote:
> J. Greenlees wrote:
>> ~snip~
>>
> Hi.
>
> If it wasn't for the error message in the log, I would tell you to
> first look at your DNS configuration, and check how that hostname
> "dev.shawanspage.com" is being resolved. If you have two DNS servers
> configured, and the first one for some reason is not answering, then
> your local resolver will first wait for an answer from the first one,
> time out, then try the second one. That could be your delay.

It was, but now the additional vhosts are finding to the default.

>
> Second, remember that the first Vhost is the default Vhost. That
> means that when any request somehow arrives to your server, if the
> server cannot match the "Host:" header in the request, with one of
> your VHost "ServerName" lines, it will process the request using the
> first defined VHost, no matter what its own "ServerName" line says.
>
Yup, I know.

> But then there is the error log.
> Because the message occurs in the log of the default VHost, it seems
> to indicate that the request did not match the ServerName of your
> third VHost, and was thus processed by the default host.
> Which is strange on the face of it.
> But the error message also indicates some kind of loop. As if the
> request did arrive and was first processed by the 3rd VHost, which
> re-directed it to the same IP, but with a wrong "Host:" header, which
> caused the redirected request to be handled by the default VHost,
> which itself re-directed it and so on.
> Do you by any chance, in these VHosts, have .htaccess files in the
> DocumentRoot that would do some kind of re-direct ?
> Or is there some part of the configuration that you are not showing us ?
>
Nope, that is the entire vhost configuration section.

but just in case I'm missing a conflict somewhere, attached is the
httpd.conf
Attachments: httpd.conf (43.3 KB)


aw at ice-sa

Dec 31, 2008, 3:49 AM

Post #4 of 6 (330 views)
Permalink
Re: Virtual Host Performance Oddity [In reply to]

J. Greenlees wrote:
[...]
As slightly off-topic, I would like to add a note :

Because of the way in which VirtualHosts work, with the first-defined
VHost being the one handling all requests which somehow are "wrong", it
is often difficult to sort out where such problems are coming from.
To avoid this, I usually define a first Vhost that has some non-real DNS
ServerName (e.g. ServerName defaulthost), specifically to catch
requests that arrive at the server with an invalid hostname (for example
someone entering "http://(server-ip-address)". That one has a
DocumentRoot containing a single html index page, which shows clearly
that the caller shouldn't do that. It also has its own separate logfiles.
That helps sorting out the "wrong" calls from the "good" calls.

In your case, that would be something like :

<VirtualHost *:80>
ServerName default
DocumentRoot /home/defaulthost/docs
DirectoryIndex DontDoThat.html
ErrorLog /var/log/httpd/defaulthost-error_log
CustomLog /var/log/httpd/defaulthost-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin
DocumentRoot /home/jaqui/public_html
ServerName dev.runic-hosting.com
ErrorLog /var/log/httpd/dev.runic-hosting.com-error_log
CustomLog /var/log/httpd/dev.runic-hosting.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin
DocumentRoot /home/dawnfyre/public_html
ServerName dev.jaqui-greenlees.net
ErrorLog /var/log/httpd/dev.jaqui-greenlees.net-error_log
CustomLog /var/log/httpd/dev.jaqui-greenlees.net-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin
DocumentRoot /home/shawan/public_html
ServerName dev.shawanspage.com
ErrorLog /var/log/httpd/dev.shawanspage.com-error_log
CustomLog /var/log/httpd/dev.shawanspage.com-access_log common
</VirtualHost>

Since "default" is not a valid DNS name, nobody would ever get to your
server using "http://default". But that host would catch calls to
"http://ip-address-of-your-server", and also re-directed calls that
somehow do not have a "Host:" header, or an invalid one (like possibly
the result of wrong re-directs).
And in its logfile, you would have these calls isolated from the
explicit calls to your host "dev.runic-hosting.com".


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


lists at jaqui-greenlees

Dec 31, 2008, 4:24 AM

Post #5 of 6 (328 views)
Permalink
Re: Virtual Host Performance Oddity [In reply to]

André Warnier wrote:
> J. Greenlees wrote:
> [...]
> As slightly off-topic, I would like to add a note :
>
> Because of the way in which VirtualHosts work, with the first-defined
> VHost being the one handling all requests which somehow are "wrong",
> it is often difficult to sort out where such problems are coming from.
> To avoid this, I usually define a first Vhost that has some non-real
> DNS ServerName (e.g. ServerName defaulthost), specifically to catch
> requests that arrive at the server with an invalid hostname (for
> example someone entering "http://(server-ip-address)". That one has a
> DocumentRoot containing a single html index page, which shows clearly
> that the caller shouldn't do that. It also has its own separate logfiles.
> That helps sorting out the "wrong" calls from the "good" calls.
>
> In your case, that would be something like :
>
> <VirtualHost *:80>
> ServerName default
> DocumentRoot /home/defaulthost/docs
> DirectoryIndex DontDoThat.html
> ErrorLog /var/log/httpd/defaulthost-error_log
> CustomLog /var/log/httpd/defaulthost-access_log common
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerAdmin
> DocumentRoot /home/jaqui/public_html
> ServerName dev.runic-hosting.com
> ErrorLog /var/log/httpd/dev.runic-hosting.com-error_log
> CustomLog /var/log/httpd/dev.runic-hosting.com-access_log common
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerAdmin
> DocumentRoot /home/dawnfyre/public_html
> ServerName dev.jaqui-greenlees.net
> ErrorLog /var/log/httpd/dev.jaqui-greenlees.net-error_log
> CustomLog /var/log/httpd/dev.jaqui-greenlees.net-access_log common
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerAdmin
> DocumentRoot /home/shawan/public_html
> ServerName dev.shawanspage.com
> ErrorLog /var/log/httpd/dev.shawanspage.com-error_log
> CustomLog /var/log/httpd/dev.shawanspage.com-access_log common
> </VirtualHost>
>
> Since "default" is not a valid DNS name, nobody would ever get to your
> server using "http://default". But that host would catch calls to
> "http://ip-address-of-your-server", and also re-directed calls that
> somehow do not have a "Host:" header, or an invalid one (like possibly
> the result of wrong re-directs).
> And in its logfile, you would have these calls isolated from the
> explicit calls to your host "dev.runic-hosting.com".
>
>
well, I like that idea.
found out that both the second and third vhost containers are not being
read.
changed the conf to have the hostname specified rather than the *:80

which apachectl give this warning:
apachectl stop
[Wed Dec 31 04:14:38 2008] [warn] NameVirtualHost
dev.jaqui-greenlees.net:80 has no VirtualHosts
[Wed Dec 31 04:14:38 2008] [warn] NameVirtualHost dev.shawanspage.com:80
has no VirtualHosts
apachectl start
[Wed Dec 31 04:15:23 2008] [warn] NameVirtualHost
dev.jaqui-greenlees.net:80 has no VirtualHosts
[Wed Dec 31 04:15:23 2008] [warn] NameVirtualHost dev.shawanspage.com:80
has no VirtualHosts


ok, going back to the *:80 got rid of the warnings.
but now only the default is working.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


aw at ice-sa

Dec 31, 2008, 4:50 AM

Post #6 of 6 (326 views)
Permalink
Re: Virtual Host Performance Oddity [In reply to]

J. Greenlees wrote:
[...]

1) maybe not the problem, but you have (at least) 3 times this section :
<Directory /var/www/html>
All these directives overlap one another, so it's rather difficult to
figure out what is going on.

2) you define your VirtualHost sections in the main http.conf file.
That is ok, but then you also have this line, and after those
VirtualHost sections :
Include conf/vhosts.d/*.conf

That line will "include" in your config file, at this point, any
"*.conf" file that is present in the conf/vhosts.d directory.
Have you looked at them ?

I would suggest, at least, to move your own VirtualHost sections *after*
that line.

What you should really do, to keep things consistent in this kind of
Apache installation, is as follows :
Each of your VirtualHost sections should be in its own file, for example
conf/vhosts.d/dev_shawan.conf
conf/vhosts.d/dev_jaqui.conf
..
etc..
Then they will be added automatically (in alphabetical order) by the line
Include conf/vhosts.d/*.conf

(which should really be the last, or almost, of your main httpd.conf file.

Then also your other following statements will look more in context.

Also don't forget that anything that you define in your httpd.conf file,
outside of a <VirtualHost> section (whether it is directly in the file
itself or inserted via an Include), is in fact a *default* for *all*
your VirtualHosts (meaning it is valid for each VirtualHost, unless
redefined in the <VirtualHost> section itself.

All in all, because of these various things, your configuration right
now is a bit "messy", which probably makes it hard to spot a real problem.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.