Exclude specific domains from Apache2 serverAlias while using a catch all *(wildcard) alias

Posted by Victor S on Server Fault See other posts from Server Fault or by Victor S
Published on 2011-11-19T17:12:37Z Indexed on 2011/11/19 17:56 UTC
Read the original article Hit count: 841

Filed under:
|
|

I have a web application that needs to support custom domains, in that regard I have set-up the following name based virtual server:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias * *.example.com www.example.com example.com
    RailsEnv production
    RackEnv production
    DocumentRoot /srv/www/example/current/public
    <Directory /srv/www/example/current/public>
             AllowOverride all
             Options -MultiViews FollowSymLinks
    </Directory>
    ErrorLog /srv/www/example/log/error.log
    TransferLog /srv/www/example/log/access.log
</VirtualHost>

Notice the * as the server alias? that catches all the domains on that server. However, I have other sites on this server which I want to be excluded from this list. It is more economical for me to have a list of excluded domains than manually set every domain a user may register with at this service as a serverAlias...

Perhaps this is not the best way to go, but I'm looking for help, in the best (relatively simple) way to set up a web-app that may catch any domains, while allowing other specific domains to be routed to different apps.

Thanks!

© Server Fault or respective owner

Related posts about apache2

Related posts about wildcard