Link to home
Start Free TrialLog in
Avatar of loki0609
loki0609

asked on

Apache Virtual Host Catch All

I'm on Ubuntu EC2 using Apache and was wondering if there was anything wrong with the following.

We are using the sites-available and sites-enabled and I have a number of different sites configured each with their own file. Everything is working great. I now want to create a new file and I'll call it

zzz-subsites

I name it this so it's processed very last. In the file I have the following.

<virtualhost *:80>
                 ServerAlias www.*.com www.*.net
                 DocumentRoot /var/www/mysubsites
</virtualhost>

I test it and it looks like its working. I'm hoping someone can point out if there will be any issues or pitfalls by doing this.

What I'm trying to accomplish is this. We have over 150 sites that are served up but a single application. It sees the domain name that comes in, say www.firstsub.com and then serves up the unique content for that site. I don't want to create 150 virtual hosts ALL pointing to the same document root and I want the team who creates and works on the sites to simply set up the pointers in the registrar which they have access to and then they are done without involving me.

edit: The subsites will ALWAYS come in as www since in godaddy we forward the main site to the www cname which points to a AWS loadbalancer.
ASKER CERTIFIED SOLUTION
Avatar of gheist
gheist
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of loki0609
loki0609

ASKER

They have the same framework but the content is unique and is pulled dynamically based on the incoming url (we are a franchisor).
Get a list of all hist names and generate 150 conf files (named after middle part of host?)?

You can include e.g /etc/httpd/franchises/*.conf and tune each to your liking.