I have a LINODE 512 account (Ubuntu 10.04 LTS) where I have got 1 IP. Using /etc/apache2/sites-available (enabled) I have hosted 4 websites, which is working very well.

But the IP address I have got gets associated with the latest website I create in my account using DNS manager. That means when I type IP address in browser it opens the latest added website only.

Now how to change that association so that it can open any website from my account I want?

1 Answer 1


This is fundamentally not possible. This has nothing to do with DNS — it has everything to do with Apache VirtualHosts and the "Host" HTTP header.

Apache distinguishes the VirtualHost you are trying to access by the "Host" header sent in HTTP. See this site for an example.

When you are accessing your web server via the IP address, the "Host" header simply contains the IP address — i.e. not the DNS name of your hosted domains. This means Apache can't tell which site you want, and serves the first one it knows about. (Most likely you'll find it is the one that appears first in your configuration, alphabetically.)

Have a think about it. If you browse to your Linode's IP (without using a DNS name), how does Apache know which VirtualHost you meant to browse to, when you haven't actually told it thus?

You may be able to work around it by putting a "ServerAlias my_linode_ip" stanza in your VirtualHost config, but this only works for one site at a time. (i.e. you need to change the config to change where the direct IP points.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .