Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a Windows 2008 R2 (VPS) server.

I have DNS enabled/installed and WAMP as the web server. Initially was going to be IIS but my php application framework I am using is not compatible with IIS.

Is there a way to configure DNS to accept all subdomains.

This way I can manage routes to each domain in the Apache vhost conf file. Or do I need to explicitly declare each sub-domain in the DNS zone.

My Forward lookup Zones are - DNS Settings are;

Name Server (NS)  | ns1.mydnsserver.com
Host (A)  | XXX.XXX..... (IP)  | FQDN awebsite.com
Alias (CNAME)  | awebsite.com

To add a subdomain I used

Host (A)  | XXX.XXX.... (IP) | staging.awebsite.com

But it would be good if I could do something like

Host (A)  | XXX.XXX.... (IP) | *.awebsite.com  <- where * is a wildcard

//I have omitted the MX records as I don't think they are relevant.

Im no Server admin, just a friendly PHP developer so I like variables. But if this is either not possible or not recommended would be good to hear what you all think.

I have tried looking this up on Google but I cant seem to find much out there.

But as shown above to make this work for all Aliases in the vhost file, I have to create a record for each sub-domain. Is it possible to use a windcard ?, if so, is it safe to do so ?

Apache Conf-vhost file

Both work fine below only if I have the A record in the DNS service, but since I will be hosting many sites Id rather just have a wildcard subdomain record if possible.

# Live
# Accepts : awebsite.com.au
#           www.awebsite.com.au
#           ws1.awebsite.com.au
<VirtualHost *:80>
    ServerName awebsite.com.au.
    ServerAlias www.awebsite.com.au.
    ServerAlias ws1.awebsite.com.au.
    DocumentRoot "c:/wamp/www/awebsite.com.au/ws1"
    <Directory "c:/wamp/www/awebsite.com.au/ws1">
        Allow from all
        Order allow,deny
    ErrorLog "c:/wamp/logs/sites/awebsite.com.au/ws1.error.log"
    CustomLog "c:/wamp/logs/sites/awebsite.com.au/ws1.access.log" common
    TransferLog "c:/wamp/logs/sites/awebsite.com.au/ws1.transfer.log"

# Staging
# Accepts : staging.awebsite.com.au
#           ws2.awebsite.com.au
<VirtualHost *:80>
    ServerName staging.awebsite.com.au.
    ServerAlias ws2.awebsite.com.au.    
    DocumentRoot "c:/wamp/www/awebsite.com.au/ws2"
    <Directory "c:/wamp/www/awebsite.com.au/ws2">
        Allow from all
        Order allow,deny
    ErrorLog "c:/wamp/logs/sites/awebsite.com.au/ws2.error.log"
    CustomLog "c:/wamp/logs/sites/awebsite.com.au/ws2.access.log" common
    TransferLog "c:/wamp/logs/sites/awebsite.com.au/ws2.transfer.log"

If any of this is unclear just comment and Ill fix/clear it up.


share|improve this question

1 Answer 1

You can always use a wildcard both in the apache conf file & also in the DNZ zones. There shouldn't be any problem with both of them.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.