I have an Apache server that has one Virtual Host with multiple Server Aliases, and I experience slow access times depending on what name I use to access the website.
My httpd.conf file:
ServerName 192.168.1.11:80
<VirtualHost 192.168.1.11:80>
Alias /robots.txt /var/www/robots.txt
Alias /static/ /home/django/www/ERate/static/
<Directory /home/django/www/ERate/static>
Order deny,allow
Allow from all
</Directory>
<Location /admin>
order deny,allow
deny from all
allow from 192.168.1 127.0.0.1
</Location>
WSGIScriptAlias / /home/django/www/ERate/apache/django.wsgi
ServerName 192.168.1.11
ServerAlias webserver.internal.on-tech.com webserver www www.internal.on-tech.com www.data.on-tech.com data.on-tech.com
</VirtualHost>
When I try to access the server with 192.168.1.11, the page loads within a second or two, but if I try to access it using one of the aliases, the page takes 5 seconds the first time, and 20+ seconds the next time. If I wait several minutes after accessing it, the time seems to reset to 5 seconds.
I think the problem is in httpd.conf because if I switch the server name with one of the aliases, the new server name becomes the address at which access is fast. Can anyone explain why this slowdown is occurring and how I can fix it?
Edit: At maliq's suggestion, I changed the relevant lines to
ServerName webserver.internal.on-tech.com
ServerAlias webserver www www.internal.on-tech.com www.data.on-tech.com data.on-tech.com
The problem still occurs, with access to the site using webserver.internal.on-tech.com going significantly faster than access to any of the aliases.
DNS for the site appears to be working (no DNS errors), and the DNS records for this server are
webserver.internal.on-tech.com -> A record: 192.168.1.11
www.internal.on-tech.com -> CName: webserver.internal.on-tech.com
www.data.on-tech.com -> A record: 192.168.1.11
data.on-tech.com -> CName: www.data.on-tech.com
ServerName
s are not full qualified hostnames. They are IPs, so change that. Choose one of the Aliases as the Servername and the others as aliases. Then make sure that your DNS is functioning correctly.