VirtualHosts : What am I doing wrong?

  • Frostbyt3
  • Graduate
  • Graduate
  • User avatar
  • Posts: 221
  • Loc: Corpus Christi, TX

Post 3+ Months Ago

I'm trying to set up the following.

I have a domain (allforcheap.com).

I have A Records for and CNAMES for allforcheap.com and http://www.allforcheap.com and an A Record for failedbreakins.allforcheap.com.

If I go to http://www.allforcheap.com or http://allforcheap.com it works fine. I get the apache test page.
If I go to http://failedbreakins.allforcheap.com I also get the test page.

Problem is : I have an index.html in each one so it should NOT be showing the test page. It should be showing the different pages. I have declared that in my config but I'm not quite sure what's wrong and I know there is something missing.

Thanks in Advance.

APACHE Code: [ Select ]
<VirtualHost *>
#NameVirtualHost allforcheap.com:80
DocumentRoot "/home/allforcheap"
ServerAdmin "admin@allforcheap.com"
ServerName allforcheap.com
ServerAlias allforcheap.com *.allforcheap.com
ErrorLog /home/allforcheap/errorlog
CustomLog /home/allforcheap/customlog common
DirectoryIndex index.html index.htm
<Directory "/home/allforcheap">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
 
 
<VirtualHost *>
#NameVirtualHost failedbreakins.allforcheap.com:80
DocumentRoot "/home/failedbreakins"
ServerAdmin "admin@allforcheap.com"
ServerName failedbreakins.allforcheap.com
ServerAlias failedbreakins.allforcheap.com
ErrorLog /home/failedbreakins/errorlog
CustomLog /home/failedbreakins/customlog common
DirectoryIndex index.html index.htm
<Directory "/home/failedbreakins">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
 
  1. <VirtualHost *>
  2. #NameVirtualHost allforcheap.com:80
  3. DocumentRoot "/home/allforcheap"
  4. ServerAdmin "admin@allforcheap.com"
  5. ServerName allforcheap.com
  6. ServerAlias allforcheap.com *.allforcheap.com
  7. ErrorLog /home/allforcheap/errorlog
  8. CustomLog /home/allforcheap/customlog common
  9. DirectoryIndex index.html index.htm
  10. <Directory "/home/allforcheap">
  11. allow from all
  12. Options +Indexes
  13. </Directory>
  14. </VirtualHost>
  15.  
  16.  
  17. <VirtualHost *>
  18. #NameVirtualHost failedbreakins.allforcheap.com:80
  19. DocumentRoot "/home/failedbreakins"
  20. ServerAdmin "admin@allforcheap.com"
  21. ServerName failedbreakins.allforcheap.com
  22. ServerAlias failedbreakins.allforcheap.com
  23. ErrorLog /home/failedbreakins/errorlog
  24. CustomLog /home/failedbreakins/customlog common
  25. DirectoryIndex index.html index.htm
  26. <Directory "/home/failedbreakins">
  27. allow from all
  28. Options +Indexes
  29. </Directory>
  30. </VirtualHost>
  31.  
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

You need to define "NameVirtualHost" *before* you define your virtual hosts. If all your virtual hosts are running on the same port, you only need to define this once.

Also, note how I wrote the actual <VirtualHost> directive - it should match NameVirtualHosts.

Code: [ Select ]
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "/home/allforcheap"
    ServerAdmin "admin@allforcheap.com"
    ServerName allforcheap.com
    ServerAlias allforcheap.com *.allforcheap.com
    ErrorLog /home/allforcheap/errorlog
    CustomLog /home/allforcheap/customlog common
    DirectoryIndex index.html index.htm
    <Directory "/home/allforcheap">
        allow from all
        Options +Indexes
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/home/failedbreakins"
    ServerAdmin "admin@allforcheap.com"
    ServerName failedbreakins.allforcheap.com
    ServerAlias failedbreakins.allforcheap.com
    ErrorLog /home/failedbreakins/errorlog
    CustomLog /home/failedbreakins/customlog common
    DirectoryIndex index.html index.htm
    <Directory "/home/failedbreakins">
        allow from all
        Options +Indexes
    </Directory>
</VirtualHost>
  1. NameVirtualHost *:80
  2. <VirtualHost *:80>
  3.     DocumentRoot "/home/allforcheap"
  4.     ServerAdmin "admin@allforcheap.com"
  5.     ServerName allforcheap.com
  6.     ServerAlias allforcheap.com *.allforcheap.com
  7.     ErrorLog /home/allforcheap/errorlog
  8.     CustomLog /home/allforcheap/customlog common
  9.     DirectoryIndex index.html index.htm
  10.     <Directory "/home/allforcheap">
  11.         allow from all
  12.         Options +Indexes
  13.     </Directory>
  14. </VirtualHost>
  15. <VirtualHost *:80>
  16.     DocumentRoot "/home/failedbreakins"
  17.     ServerAdmin "admin@allforcheap.com"
  18.     ServerName failedbreakins.allforcheap.com
  19.     ServerAlias failedbreakins.allforcheap.com
  20.     ErrorLog /home/failedbreakins/errorlog
  21.     CustomLog /home/failedbreakins/customlog common
  22.     DirectoryIndex index.html index.htm
  23.     <Directory "/home/failedbreakins">
  24.         allow from all
  25.         Options +Indexes
  26.     </Directory>
  27. </VirtualHost>

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 30 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.