I'm running into a weird server access problem, where accessing the host by one name results in succes, whilst the other black holes.
I'm logged in to qa-webapp-001.mycompany.com
, which can be found in DNS in three places:
qa-webapp-001$ nslookup qa-webapp-001.mycompany.com
Server: 10.10.2.1
Address: 10.10.2.1#53
qa-webapp-001.mycompany.com canonical name = qa-webapp-001.prod.mycompany.com.
Name: qa-webapp-001.prod.mycompany.com
Address: 10.10.2.10
qa-webapp-001$ nslookup qa-webapp-001.prod.mycompany.com
Server: 10.10.2.1
Address: 10.10.2.1#53
Name: qa-webapp-001.prod.mycompany.com
Address: 10.10.2.10
qa-webapp-001$ nslookup qa-webapp-001
Server: 10.10.2.1
Address: 10.10.2.1#53
qa-webapp-001.mycompany.com canonical name = qa-webapp-001.prod.mycompany.com.
Name: qa-webapp-001.prod.mycompany.com
Address: 10.10.2.10
From every host on the network, I can curl to the web server running on this host and get the index back:
my-box$ curl qa-webapp-001
*SUCCESS*
my-box$ curl qa-webapp-001.prod.mycompany.com
*SUCCESS*
my-box$ curl qa-webapp-001.mycompany.com
*SUCCESS*
However, from qa-webapp-001 itself, this is not true:
qa-webapp-001$ curl qa-webapp-001
*SUCCESS*
qa-webapp-001$ curl qa-webapp-001.prod.mycompany.com
*SUCCESS*
qa-webapp-001$ $ curl -v http://qa-webapp-001.advanis.ca/
* About to connect() to qa-webapp-001.advanis.ca port 80 (#0)
* Trying ::1... connected
* Connected to qa-webapp-001.advanis.ca (::1) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.6 (i386-portbld-freebsd6.2) libcurl/7.19.6 OpenSSL/0.9.7e zlib/1.2.3 libssh2/1.2
> Host: qa-webapp-001.advanis.ca
> Accept: */*
>
**HANGS UNTIL CURL TIMEOUT**
This is the output of ifconfig:
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_MTU>
inet 10.10.2.10 netmask 0xffffff00 broadcast 10.10.2.255
ether 00:0c:29:a6:17:56
media: Ethernet autoselect (1000baseTX <full-duplex>)
status: active
plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
My apache configuration has the following bind, listen, and servername directives (beyond that, I'm not sure what might be relevant):
Listen 10.3.1.22:443
Listen 10.1.1.22:80
Listen 10.1.1.22:443
BindAddress 10.3.1.22
BindAddress 10.1.1.22
Port 80
<IfDefine SSL>
Listen 80
Listen 443
</IfDefine>
ServerName qa-webapp-001.mycompany.com
Here is the output of /usr/local/sbin/httpd -S
:
VirtualHost configuration:
[::1]:80 qa-webapp-001.mycompany.com (/usr/local/etc/apache22/extra/httpd-vhosts.conf:27)
127.0.0.1:80 qa-webapp-001.mycompany.com (/usr/local/etc/apache22/extra/httpd-vhosts.conf:27)
wildcard NameVirtualHosts and _default_ servers:
_default_:443 qa-webapp-001.mycompany.com (/usr/local/etc/apache22/extra/httpd-ssl.conf:74)
Syntax OK
I can't see any reason why this would be failing for just that one hostname, can anyone suggest a reason?
Try curling to http://127.0.0.1/ ; I suspect apache may not know how to dispatch based on the IPv6 address that got used for localhost.
If that works, fix your /etc/hosts to map qa-webapp-... to 127.0.0.1 first.
Or fix apache. This answer shows the basics of how to do that.