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>
link|improve this question
Belongs on ServerFault.com – Calvin Froedge Aug 4 '11 at 20:25
Sorry I didn't know, but seeing as there are many topics on stackoverflow I thought it was okay. – Jay Aug 4 '11 at 22:12
Please post your solution as an answer, not in the question itself. – Mat Aug 6 '11 at 8:30
feedback

migrated from stackoverflow.com Aug 6 '11 at 18:42

This question came from our site for professional and enthusiast programmers.

1 Answer

Get rid of the http:// in the server name. An no need for quotes in the directory paths

link|improve this answer
Thanks although it didn't make a difference to my specific problem – Jay Aug 4 '11 at 22:12
feedback

Your Answer

 
or
required, but never shown