Apache Config

14

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.

Filed under General by  #

Comments on Apache Config Leave a Comment

1/17/2012

Alegro @ 3:00 pm #

----

1/21/2012

Kisha Mehdi @ 1:41 pm #

----

1/22/2012

Bertie Lomack @ 1:50 pm #

----

Amira Landsaw @ 11:30 pm #

----

1/24/2012

Stacee Mcnairy @ 8:09 pm #

----

1/25/2012

Ai Mattina @ 6:11 pm #

----

1/26/2012

----

1/27/2012

Jimmie Hummert @ 11:42 pm #

----

1/28/2012

Kyoko Godkin @ 11:25 am #

----

Gary Fron @ 6:07 pm #

----

1/29/2012

Yolande Helzer @ 6:28 pm #

----

----

1/30/2012

Shanae Cwik @ 8:55 pm #

----

2/3/2012

----

Leave a Comment

Fields marked by an asterisk (*) are required.


6 − five =

Register Login

Switch to our mobile site