I've recently come into a small vps that I wanted to setup my blog on. Currently I'm using my domain server providers nameservers.
I've setup an A Address (Record) to point to my VPS IP address for a blog.example.com subdomain.
blog | A | 123.456.789
I've setup apache (httpd) on the vps and have configured the virtualhosts as such:
<VirtualHost *:80>
DocumentRoot "/var/www/html/blog"
ServerName http://blog.example.com
<Directory "/var/www/html/blog">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
My problem is now when I type in my VPS IP (123.456.789) directly into the browser it goes to my blog and not the document root. So none of the files in /var/www/html are accessible.
SOLUTION:
I added another entry into the vhosts for my VPS's ip and the apache root directory and all is fine.
Thanks.
<VirtualHost *:80>
DocumentRoot "/var/www/html/blog"
ServerName http://blog.example.com
<Directory "/var/www/html/blog">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName 123.456.789
<Directory /var/www/html>
allow from all
Options +Indexes
</Directory>
</VirtualHost>