If you own a Direactadmin server, most probably you would like to add something to default virtualhost settings, when a new user is created. You might need any specific php settings, or anything related to Apache – this doesn’t really matter. Let’s see where we can modify these settings; you will need SSH access to your server as we will edit a configuration file.
We need to go to the directory, where configuration templates are located. It is /usr/local/directadmin/data/templates. There are lots of files, but we need virtual_host.conf to make the necessary changes to default virtualhost settings.
A default file should look like this (this is the original version):
|?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/cgi-bin/|
ServerAlias www.|DOMAIN| |DOMAIN| |SERVER_ALIASES|
CustomLog /var/log/httpd/domains/|DOMAIN|.bytes bytes
CustomLog /var/log/httpd/domains/|DOMAIN|.log combined
Options +Includes -Indexes
php_admin_flag engine |PHP|
php_admin_flag safe_mode |SAFE_MODE|
php_admin_value sendmail_path ‘/usr/sbin/sendmail -t -i -f |USER|@|DOMAIN|’
php_admin_value open_basedir |OPEN_BASEDIR_PATH|
suPHP_UserGroup |USER| |GROUP|
For example, we need to have a common include directory for PHP scripts, operated by many users. Certainly it is possible to go to /usr/local/directadmin/data/users and change include settings one by one. You can also edit php.ini, but this is the most unsecure solution.
In order to add a directory for common inclusion, we need to add it to the following string:
This file is easy to understand so if you need to have some specific settings, it is quite easy to apply them. For example, if you need to use wildcard subdomains, you will need the following string:
ServerAlias *.|DOMAIN| |DOMAIN| |SERVER_ALIASES|
Any changes related to default Directadmin virtualhost should be made in this file.
If you need to apply changes to existing users, the glue is to run the following command via SSH:
echo “action=rewrite&value=httpd” >> /usr/local/directadmin/data/task.queue /usr/local/directadmin/dataskq d
This will apply the canges made to all users. All virtualhosts will be rewritten, so triple check the configuration before applying this command – in case of any error your sites may stop working.