Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache VirtualHost, multiple ServerName in one line

I am using the following tag

<VirtualHost *:80 *:443>

    ServerName blog.mydomain.com
    ServerAlias blog

to create a virtual host. I've put the ServerName as my subdomain which is blog. However, i'm trying to figure out a way to add www.blog. aswell in the same line rather than having to create a completely new virtual host.

Is there a way for this to be done?

like image 695
John Avatar asked Dec 23 '14 10:12

John


People also ask

How many virtual hosts can Apache handle?

If each virtual host has its own log, the limit is likely 64 due to file descriptor limits.


1 Answers

Apache allows multiple server Aliases

<VirtualHost *:80>
     
     ...

     ServerName blog.mydomain.com
     ServerAlias www.blog.com
     ServerAlias blog
     ServerAlias add-as-many-as-you-want

     ...
    
</VirtualHost>
like image 63
Abdulbasit Avatar answered Nov 07 '22 09:11

Abdulbasit