How do I create Sub Domains?

Aziz

Verified User
Joined
Oct 4, 2004
Messages
125
How to dynamically creat sub domains?

Hi guys,

I would like to create sub domains dynamically, do I just create a folder in the main site and it will be a directory.. If not what files do I need to edit and what to edit them too.

I also would need to track each folder's (sub domain's) bandwith..

I would appreciate any guidance/help and/or ideas..

Thanks alot,
Aziz
 
Last edited:
If by dynamically you mean not through DirectAdmin's interface, there isn't a way to do it that I know if since
1. There is no command in the API last I checked.
2. Any modifications you make to the httpd.conf file might be overwritten in the future, however there is a workaround mentioned on these forums (I believe it just involved changing permissions to where it was still readable but not writable by DirectAdmin)

If you were to do that, then you could simply add the proper directives to that users httpd.conf file as well as other data files in /usr/local/directadmin/data/users/username/

However, I'll bring up the point that unless the script is running with the proper permissions that Does have permission to write to the files (root or diradmin), then it won't work.
So it's rather a dilema.

Most reliable way is to just do it through DirectAdmin's interface, at least for right now.

Somebody else might have a proper workaround or ideas.

Edit: However on futher thought (theory really), If you added the subdomain to all the propery places in DirectAdmin's data files, named database, and httpd conf, you wouldn't have to worry about DirectAdmin overwriting the httpd.conf (if you can use the same template) since it would be a recognized subdomain in DirectAdmin. However if you could get that to work, the script would still need root privileges which may not be wise todo if this is for a script available to the public.

Edit #2: And to tie all this editting up, if you were simply asking how to create a subdomain: http://site-helper.com/subdomains.html#create
 
Last edited:
jmstacey said:
If by dynamically you mean not through DirectAdmin's interface, there isn't a way to do it that I know if since
1. There is no command in the API last I checked.
2. Any modifications you make to the httpd.conf file might be overwritten in the future, however there is a workaround mentioned on these forums (I believe it just involved changing permissions to where it was still readable but not writable by DirectAdmin)

If you were to do that, then you could simply add the proper directives to that users httpd.conf file as well as other data files in /usr/local/directadmin/data/users/username/

However, I'll bring up the point that unless the script is running with the proper permissions that Does have permission to write to the files (root or diradmin), then it won't work.
So it's rather a dilema.

Most reliable way is to just do it through DirectAdmin's interface, at least for right now.

Somebody else might have a proper workaround or ideas.
[/url]

I actually want to dynamically create the users sub domains and also to make a cron job to keep tracking their bandwidth and make sure they do not go over the limit..

thanks for giving me the idea, I will take a look at it..

the link to the discussion you said took place prior (I tried searching, but did not find it) would be really helpful..

Thanks alot,
Aziz
 
I tried finding that post but no luck..

anyone know where to start in?

thanks alot,
 
ballyn said:
There is a "create subdomain" API call... see the API docs. http://www.directadmin.com/api.html

Bandwidth will be calculated along with the user's normal bandwidth, AFAIK.

thanks alot for the link,

so I can create sub domains on the fly...

how will I be able to access the bandwith usage for each sub domain?

Thanks in advance,
Aziz
 
Back
Top