Networking Forums

Networking Forums > Computer Networking > Linux Networking > Apache web host name resolution question

Reply
Thread Tools Display Modes

Apache web host name resolution question

 
 
Ed Marsh
Guest
Posts: n/a

 
      07-09-2004, 04:54 PM
I have just setup Apache web server, PHP, MySQL and PostgreSQL on my
Fedora Core II system. When writing some HTML pages which call remote
PHP routines, I noticed a long delay before the branched call to the PHP
routine completes. I snooped the network and noticed that the web
server is trying to resolve my server's hostname by going to the
external DNS server. After this fails it resubmits the request to Yahoo
and a few other lookup servers - fails, and then comes right back to my
home gateway router where it directs the call back to the IP address of
my Linux Apache server (where it should have been originally). The
delay is about 90+ seconds or so. I am trying to do some performance
testing, so this is not acceptable.

I thought that the Apache web server would follow the instructions of
the /etc/nsswitch.conf file and check the local /etc/hosts file first to
resolve the hostname before using DNS, but this is apparently not the
case. I suspect that I am going to have to set up a local domain in my
private network and a proxy server to keep intranet queries local.
However, I am hoping that I am wrong and someone has a simplier solution.

Thanks,
Ed

 
Reply With Quote
 
 
 
 
David Efflandt
Guest
Posts: n/a

 
      07-09-2004, 06:06 PM
On Fri, 09 Jul 2004 11:54:12 -0500, Ed Marsh <(E-Mail Removed)> wrote:
> I have just setup Apache web server, PHP, MySQL and PostgreSQL on my
> Fedora Core II system. When writing some HTML pages which call remote
> PHP routines, I noticed a long delay before the branched call to the PHP
> routine completes. I snooped the network and noticed that the web
> server is trying to resolve my server's hostname by going to the
> external DNS server. After this fails it resubmits the request to Yahoo
> and a few other lookup servers - fails, and then comes right back to my
> home gateway router where it directs the call back to the IP address of
> my Linux Apache server (where it should have been originally). The
> delay is about 90+ seconds or so. I am trying to do some performance
> testing, so this is not acceptable.
>
> I thought that the Apache web server would follow the instructions of
> the /etc/nsswitch.conf file and check the local /etc/hosts file first to
> resolve the hostname before using DNS, but this is apparently not the
> case. I suspect that I am going to have to set up a local domain in my
> private network and a proxy server to keep intranet queries local.
> However, I am hoping that I am wrong and someone has a simplier solution.


It could be your browser (which one?) that is using DNS and search first
before /etc/hosts. Some have a built-in DNS cache, or attempt to search
for a name. I know when I used to netscape, it thought that
http://localhost/ was an incomplete FQDN and would attempt to search for
localhost, and come up with localhost.com (a registered domain), which of
course would not have the local resource I was looking for. That feature
(Smart Search?) can be diasbled.

I do not know how you construct those PHP URLs, but perhaps using
HTTP_HOST from env and/or changing UseCanonicalName to off in apache may
help, so your browser would use the name that worked (from Host header)
instead of the server's set or assumed ServerName. But since you say
"remote" PHP you may need to do something more if accessed from LAN
or internet (maybe SSI or other dynamic content).

--
David Efflandt - All spam ignored http://www.de-srv.com/
 
Reply With Quote
 
Ed Marsh
Guest
Posts: n/a

 
      07-09-2004, 08:00 PM
The browser is Netscape (7.x, if memory serves). The actual flow is very
simple. The HTML page lacated in the html web page directory simply
provides a form which is filled out and than "submits" the form data to
a PHP routine located in the same directory. I assume that the browser
(or server) decides to fully qualify the name of the PHP path name using
the server name (FQDN) and then attempts to resolve the name - thus, it
begins to query the DNS servers, times out, then begins to query a few
other servers like yahoo.

I found the "smart" domain guessing option you mentioned and when I get
home, I will see if that solves my problem.

thanks

David Efflandt wrote:
> On Fri, 09 Jul 2004 11:54:12 -0500, Ed Marsh <(E-Mail Removed)> wrote:
>
>>I have just setup Apache web server, PHP, MySQL and PostgreSQL on my
>>Fedora Core II system. When writing some HTML pages which call remote
>>PHP routines, I noticed a long delay before the branched call to the PHP
>>routine completes. I snooped the network and noticed that the web
>>server is trying to resolve my server's hostname by going to the
>>external DNS server. After this fails it resubmits the request to Yahoo
>>and a few other lookup servers - fails, and then comes right back to my
>>home gateway router where it directs the call back to the IP address of
>>my Linux Apache server (where it should have been originally). The
>>delay is about 90+ seconds or so. I am trying to do some performance
>>testing, so this is not acceptable.
>>
>>I thought that the Apache web server would follow the instructions of
>>the /etc/nsswitch.conf file and check the local /etc/hosts file first to
>>resolve the hostname before using DNS, but this is apparently not the
>>case. I suspect that I am going to have to set up a local domain in my
>>private network and a proxy server to keep intranet queries local.
>>However, I am hoping that I am wrong and someone has a simplier solution.

>
>
> It could be your browser (which one?) that is using DNS and search first
> before /etc/hosts. Some have a built-in DNS cache, or attempt to search
> for a name. I know when I used to netscape, it thought that
> http://localhost/ was an incomplete FQDN and would attempt to search for
> localhost, and come up with localhost.com (a registered domain), which of
> course would not have the local resource I was looking for. That feature
> (Smart Search?) can be diasbled.
>
> I do not know how you construct those PHP URLs, but perhaps using
> HTTP_HOST from env and/or changing UseCanonicalName to off in apache may
> help, so your browser would use the name that worked (from Host header)
> instead of the server's set or assumed ServerName. But since you say
> "remote" PHP you may need to do something more if accessed from LAN
> or internet (maybe SSI or other dynamic content).
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic Apache Web Server Question JMecc Linux Networking 5 12-16-2006 08:19 PM
host name resolution order Niclas Windows Networking 1 11-17-2006 09:37 AM
How do I host my Apache web site if my isp blocks port 80? Leo Linux Networking 30 01-09-2005 06:45 PM
Proftpd + Apache: a question on ftp access configuration fil Linux Networking 0 12-18-2003 10:26 AM
Problem with Apache & name resolution Peter Nunn Linux Networking 2 10-30-2003 09:21 PM



1 2 3 4 5 6 7 8 9 10 11