Tag: serveralias
Wildcard *.domain.com
by admin on Oct.07, 2011, under DirectAdmin
If you’d like to setup your domain to accept anything.domain.com, you can do so with the following guide (Admin access required)
1) Setup the dns with a wildcard A record. Go to Dns Control, and add an "A" record:
* -> 1.2.3.4
where 1.2.3.4 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:
|*if SUB|
ServerAlias |SUB|.domain2.com
|*endif|
which will make any existing subdomain from domain2.com point to domain.com.
Incoming search terms:
tes wildcard dns,wildcard domain directadminAdding custom httpd.conf code to the VirtualHosts of a domain
by admin on Sep.07, 2009, under DirectAdmin
DirectAdmin Allows Admin to insert extra httpd.conf code that a User may require. To access the control page for this functionality, go to Admin Panel -> Admin Settings -> Customize Httpd Configurations.
Once you see the list of domain, click the domain you wish to insert the extra httpd.conf code to.
At the bottom of the page, you’ll see the current httpd.conf for that User. It will contain all VirtualHosts for all domain, subdomains and redirects. Any changes made by this page will only affect the VirtualHosts for the domain in question, not the other domains owned by that user. If all domains need the changes, then you would repeat this process for each domain.
The top textarea is where you will paste the custom httpd.conf code you wish to insert. The code you write will be inserted into the |CUSTOM| token for all VirtualHosts for this domain. You can edit the templates as needed if you require to move the |CUSTOM| token to a different position in the VirtualHost.
All tokens that are available for the VirtualHost will be available with this feature. You can also set any token you wish. For example, if you with to change the DocumentRoot for a domain, you can paste:
|?DOCROOT=/new/path/you/want|
Note that this new DocumentRoot will be used for all DocumentRoots for this domain, including https connections and subdomains, so it may not be a desired effect.
Another common use is to add another ServerAlias. This allows another domain to be used to access the exact same content. To accomplish this, you would write
ServerAlias newdomain.com www.newdomain.com
To get newdomain.com and www.newdomain.com to point to the original domain for the VirtualHost. You will also have to make sure that newdomain.com and www.newdomain.com both resolve to the same IP as stored in |IP|.
