Apache Config

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

After doing much googleing, and much reading of how to set up virtual hosts in apache, I finally figured it out. The documentation on this is very poor. All I wanted to do was set up apache to handle multiple domains, and to be able to handle *.domain.com and point it to a certain location. I want to be able to have domain.com, www.domain.com, something.domain.com, and *.domain.com all point to different places. Here’s what I came up with, and after consulting with others, this seems to be correct. I’ve also tried it and have it working on familylearn’s box too.

<VirtualHost *>

DocumentRoot /var/www/html

ServerName www.bagunsa.com

</VirtualHost>

<VirtualHost *>

DocumentRoot /var/www/html/post_nuke

ServerName jonas.bagunsa.com

</VirtualHost>

<VirtualHost *>

DocumentRoot /var/www/html/test

ServerName bagunsa.com

ServerAlias *.bagunsa.com

</VirtualHost>

<VirtualHost *>

DocumentRoot /var/www/html/post_nuke

ServerName www.jonasfam.com

ServerAlias jonasfam.com *.jonasfam.com

</VirtualHost>

<VirtualHost *>

DocumentRoot /var/www/html/utahrealestateadvisor

ServerName www.utahrealestateadvisor.com

</VirtualHost>

<VirtualHost *>

DocumentRoot /var/www/html/blog

ServerName www.jonasblog.com

ServerAlias jonasblog.com *.jonasblog.com

</VirtualHost>

I learned that you have to put all of your specific entries for a domain first, then you put the catchall last. The ServerName also can’t have any wildcards in it, as they should go into the ServerAlias field.

14 comments on this post.
  1. Alegro:

    ----

  2. Kisha Mehdi:

    ----

  3. Bertie Lomack:

    ----

  4. Amira Landsaw:

    ----

  5. Stacee Mcnairy:

    ----

  6. Ai Mattina:

    ----

  7. Cathryn Steinbrenner:

    ----

  8. Jimmie Hummert:

    ----

  9. Kyoko Godkin:

    ----

  10. Gary Fron:

    ----

  11. Yolande Helzer:

    ----

  12. Motocross Deutschland:

    ----

  13. Shanae Cwik:

    ----

  14. photo to painting:

    ----

Leave a comment






+ three = 11