HOW-TO: Default page on http://your_server_ip/

Several people have been talking about the problem with reseller shared IPs pointing to one customer website; since this is an important issue, here is how to handle it ...

First understand it:
The problem here is with apache name-based vhosts; the first vhost in the config file with the specified IP address has the highest priority and catches any request to an unknown server name or a request without a host.
So when someone requests the http://ip_addr then apache will show the first name-based vhost!

Now the way to solve this (it will take a bit longer to write, but i'll make a step by step just in case):

- Edit your httpd.conf pico /usr/local/apache/conf/httpd.conf
- Search for "NameVirtualHost ip_addr:80": CTRL + W; NameVirtualHost [ENTER]
- Create a new vhost entry just after that line (edit whats between the # ):


<VirtualHost #PUT_IP_HERE#>
ServerAlias #YOUR_SERVER_FQD_HOSTNAME#
ServerAdmin #YOUR_ADMIN_EMAIL#
DocumentRoot /usr/local/apache/htdocs/
ServerName #YOUR_SERVER_FQD_HOSTNAME#
</VirtualHost>



(add it after each "NameVirtualHost IP:port" of your httpd.conf)

This will create a high priority vhost entry so when you access http://ip_addr you have the default apache page

~ Dani

 

 

 

 

Top