Stop domains from being easily visible by IP address

August 16, 2013 2.3k views
I followed this tut to get virtual hosts up and running on the default DO LAMP stack. So far, so good. When I visit my IP address in a browser, I see all the domains associated with the droplet. It'd be nice (and potentially more secure?) to have that data hidden away from public view. Is this possible, and what's the best way to go about it?
3 Answers
You should not create domain root directories in /var/www
but should use more secure location. like

You can either add an empty index.html file in /var/www or set apache's virtualhost's DocumentRoot to /var/www/default:

nano /etc/apache2/sites-enabled/000-default

Edit DocumentRoot and set it to /var/www/default.

Create /var/www/default:
mkdir /var/www/default

Finally, create an empty file in it:
touch /var/www/default/index.html

Make sure you restart Apache.
@chemical.sweet - Care to expand on the potential security risk it could have? I'm following which I assume has some kind of 'best practise' thinking behind it.

@Kamal - Thanks for a useful answer.
by Etel Sverdlov
This tutorial shows you how to set up a new directory, how to grant the correct permissions, how to add content to a new page, how to turn on virtual hosting, and how to, if needed, set up local hosts. Virtual Hosts are used to run more than one domain off of a single IP address and allows you to run multiple sites off of a single DigitalOcean droplet. This tutorial describes how to set up virtual hosts with Apache.
Have another answer? Share your knowledge.