If you wish to change the setup of the VirtualHosts for all domains, you can do so by creating your own custom templates.
cd /usr/local/directadmin/data/templates
cp virtual_host2*.conf custom
cd custom
Inside the virtual_host*.conf files, you'll find code that is similar to httpd.conf code, but contains what are known as tokens. Â These tokens are what will be replaces with specific user data for each domain created.
Available tokens | |
DOMAIN | the name of the domain. eg:Â domain.com |
IP | the IP address associated with that domain. eg:Â 192.168.3.4 |
HOME | The users home directory. eg:Â /home/gary |
ADMIN | The email address of the server admin. Â webmaster@domain.com |
HOSTNAME | The hostname of the server. eg:Â server.domain.com |
SAFE_MODE | ON or OFF if php safe_mode is enabled or not |
PHP | ON or OFF if php is enabled or not |
CGI | The whole httpd.conf line used to add the Script-Alias |
HANDLERS | httpd.conf code holding all apache handlers |
MIMETYPE | httpd.conf code holding all apache mime types |
USER | the username |
GROUP | the users group name (99% of the time, it's the same as the USER) |
DOCROOT | The DocumentRoot of the VirtualHost. Â This is the path that apache will use to access the data when the ServerName (domain.com) is requested |
SUB | for the virtual_host_*sub.conf file, the subdomain name. eg:Â sub |
CUSTOM | custom httpd.conf code to be inserted if the domain.com.cust_httpd file exists. (See Adding custom httpd.conf code the VirtualHost of one domain) |
CAROOT | The whole httpd.conf line used to load in the SSLCACertificateFile directive |
CERT | The path of the certificate to be used for the domain |
CREATOR | The username of the account that created the User account who owns this domain |
KEY | The path of the certificate to be used for the domain |
The top of the templates should contain |?CGI=...| and |?DOCROOT=...|. Â These lines are where the data for the CGI and DOCROOT tokens are set. Â If cgi is not enabled, this line wil be ignored and the CGI token will be empty. Â If the domain is suspended, the DOCROOT will be filled the the path of the suspend page. Â The CAROOT token will be empty unless the User has added a valid CARootCertificate through DA.
You can use tokens when assigning a value to CGI or DOCROOT, just use `TOKEN` instead of |TOKEN|.
Once you are happy with your new virtual_host*.conf files they'll need to be used in the real httpd.conf files. Â You can trigger DirectAdmin to rewrite all User httpd.conf files by running:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
The command will be added the the task queue which is checked once per minute, so it may be a few minutes before all httpd.conf files have been rewritten. Â *Note: the main /etc/httpd/conf/httpd.conf is never overwritten (unless DirectAdmin is reinstalled) so any changes you make will be safe.Note, that you can also use if-then-else statements if you don't want all settings to be global. Â Example, say you want a custom item added, only for 1 domain:
|*if DOMAIN="domain.com"|
#custom item for just this domain
|*endif|
You can also run actual scripts with database queries, etc... if you wanted using the script portion of the templates.
More info on that here: http://www.directadmin.com/features.php?id=756