customize default subdomain

iyan

Verified User
Joined
Oct 14, 2003
Messages
22
Location
Palembang
helo,

Is domain template can be customize ?

now said i want template that when i create user :
1. create subdomain : webmail.domain.com
2. create directory "webmail" in public_html
3. create files index.php contains :

<?
Header ("Location: /webmail");
?>
 
Hello,

You could add another virtualhost directive to your /usr/local/directadmin/data/templates/virtual_host.conf. You'll first copy it to /usr/local/directadmin/data/templates/custom/virtual_host.conf, then change it to read:
Code:
|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html|
<VirtualHost |IP|:80>
|CUSTOM|
|?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/cgi-bin/|
        ServerName [url]www.[/url]|DOMAIN|
        ServerAlias [url]www.[/url]|DOMAIN| |DOMAIN|
        ServerAdmin |ADMIN|
        DocumentRoot |DOCROOT|
        |CGI|

        User |USER|
        Group |GROUP|
        CustomLog /var/log/httpd/domains/|DOMAIN|.bytes bytes
        CustomLog /var/log/httpd/domains/|DOMAIN|.log combined
        ErrorLog /var/log/httpd/domains/|DOMAIN|.error.log

        <Directory |DOCROOT|>
                Options +Includes -Indexes
        </Directory>
|HANDLERS|
|MIMETYPES|
</VirtualHost>

<VirtualHost |IP|:80>
       ServerName webmail.|DOMAIN|
       ServerAdmin |ADMIN|
       DocumentRoot /var/www/html/webmail
       
       User |USER|
       Group |GROUP|
       CustomLog /var/log/httpd/domains/|DOMAIN|.bytes bytes
       CustomLog /var/log/httpd/domains/|DOMAIN|.log combined
       ErrorLog /var/log/httpd/domains/|DOMAIN|.error.log
</VirtualHost>
Note the last virtualhost addition for webmail. Then you can type:
Code:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue

John
 
helo

john, if i excecute this, so how about the the exist subdomain i have created ?? eg. webmail.client1.com, webmail.client2.com ? i have redirect it to webmail.client1.com/webmail,

this can be broken something or have double vhost ? and this task will do add webmail.|DOMAIN| for all domain ?

is the bind zone for webmail.|DOMAIN| will be added too by DA, eg :webmail.|DOMAIN| too ? if yes, that DA make a subdomain depend of vhost, right ?

regards
IYAN
 
Hello,

Yes, you'd have to make sure that the "subdomain" wasn't created through their account (duplicate = bad). You'd also need to create an A record for "webmail". There are always far more details under the surface to all problems like this :)

This will create the VirtualHost automatically for *all* created domains automatically. It will *not* add the A record for their zone, you'd have to do that manually.

John
 
John,

how can we add template for A record for zone? DA hasn't support yet ?

regards
IYAN
 
Hello,

/usr/local/directadmin/data/templates/named.db

Note that this template doesn't have an |IP| token, so you could probably setup a CNAME (IP independant) that looks like:
Code:
|?TIME=14400|
$TTL 14400
@       IN      SOA     |NS1|      |EMAIL| (
                                                |SERIAL|
                                                7200
                                                3600
                                                1209600
                                                86400 )

webmail   14400   IN   CNAME

|NS|
|A|
|MX|
|CNAME|
|PTR|
I *think* :) ... this will point webmail.domain.com to whatever domain.com resolves to. Try that, I havn't tested it, but it seems "sound". Remember to first copy it to the "custom" directory and edit the new one from there.

John
 
Back
Top