|If you'd like to setup your domain to accept anything.domain.com, you can do so with the following guide (Admin access required)|
See the last method below, if you want other sub domains to work with their own data, or if you want the main domain to show different data.
1) Setup the dns with a wildcard A record. Go to Dns Control, and add an "A" record:
* -> 184.108.40.206
where 220.127.116.11 is the IP of your domain.
This will allow anything.domain.com to resolve to your server. Apache does not yet know how to direct that name though.
2) To setup apache, go to:
Admin Level -> Custom Httpd configurations -> domain.com
In the top text area, add this *one* line:
ServerAlias *.|DOMAIN|then click "Save".
That should be it. Wait a few minutes for everything (apache, named) to be restarted then test it out.
The wildcard subdomains will point to your main public_html directory for the domain.
If you want to change this, it's probably best not to do step 2, and to setup your own custom virtualhost manually into the /etc/httpd/conf/httpd.conf (DA wont delete/overwrite it there) with the same ServerAlias directive as in step 2.
Other similar uses might be subdomain aliasing, where test.domain.com is the same as test.domain2.com.
You can accomplish this by following step 1) above, then insert the following instead of step 2) above:
I still want all other subdomains to continue to work with their different data
You may notice that when using the DomainAlias option on your main domain, that other subdomains also get handled by the wildcard.
If you want to have a wildcard value, but still have created subdomains go elsewhere, then you'd need to do the following instead.
The premise is to make the wildcard VirtualHost show up dead last in the httpd.conf, after the other subdomain VHs are added.
1) Create the dns records in the same way as step 1) above.
2) Create a subdomain normally in DA, such that it's going to appear dead last in the subdomain list.
It's ASCII alphabetical, so, a value of zzzz may be reliably at the end of the list (unless you have special international characters like ÿ, use those instead as they're got a higher ascii value).
We'll assume you' went with zzzz.domain.com as the created subdomain.
This will store your data in the usual place:
/home/user/domains/domain.com/public_html/zzzzso that's where you're going to store your wildcard data. All wildcard URLs will go to that DocumentRoot. (If you want that to point to the main domain's public_html, either delete the zzzz directory, and replace it with a symbolic link to "..", or change the DOCROOT to the public_html in the templates (symbolic links are easiest))
3) Now to make all wildcards goto the zzzz subdomain, go to:
Admin Level -> Custom Httpd Configuration -> domain.com
In the top text-area, paste in this code:
Which, when saved, should add the ServerAlias code to only the zzzz subdomain VirtualHost, which should be at the very bottom of the User httpd.conf file.
|Wildcard *.domain.com with Nginx|
© 2003 JBMC Software, Suite 173 3-11 Bellerose Drive, St Albert, AB T8N 1P7 Canada. Mon-Fri 9AM-5PM MST