Configuration file templates (ISPmanager)
From ISPWiki
Configuration file templates can be used if the information added by the control panel when creating a domain, WWW domain, etc. is not enough. For example, you want several lines to be automatically added into the httpd.conf configuration file when creating a new WWW domain.
To add a configuration file template, create a file with one of the names listed below in the etc sub directory of the control panel's directory and specify all the lines there. They will be automatically added into the corresponding configuration file. The following templates are currently supported:
- directory.templ - when creating a new WWW domain, the lines from the file will be automatically added into the Directory section of the httpd.conf configuration file.
- domain.templ - when creating a new domain zone, the lines from the template file will be automatically added into the corresponding zone section ' of the named.conf configuration file.
- domainzone.templ - when adding a new domain zone, the zone file will be created basing on this file. Name servers, e-mail servers and alias domain records will be automatically added into this file. In the template you can provide your own parameters SOA, additional SPF, etc.
- virtualhost.templ - when creating a new WWW domain, the lines of the template file will be automatically added into the corresponding VirtualHost section of the httpd.conf configuration file.
- server.templ - when creating a new WWW domain, the contents of the server record will be automatically taken from the template file. If localhost specified in the template coincides with localhost created by ISPmanager, localhost won't be duplicated and the lines will be added to a corresponding section.
Please note, that the lines from the configuration file templates are added to the lines created by the control panel, rather than overwrite them.
Contents |
Macros
You may use macros that will be changed into the corresponding values.
domainzone.templ
- __IP__ - IP-address that was assigned when creating a new domain.
- __NAME__ - domain name.
virtualhost.templ
- __bind__ - address:port of the created WWW домена.
- __DocumentRoot__ - WWW domain root directory. This parameter allows to customize log analysers configs.
- __ServerName__ - WWW domain name.
server.templ
- __server_name__ - WWW domain name.
Example
We want the following line to be automatically added into the corresponding Directory section of the httpd.conf configuration file when creating a WWW domain.
Deny from all
Add the line into /usr/local/ispmgr/etc/directory.templ
echo "Deny from all" > /usr/local/ispmgr/etc/directory.templ
If you have used the __DocumentRoot__ macro, and want the recordDocumentRoot __DocumentRoot__ record to be created as well, it should be added into the template, because the lines used in the macros are not added into the configuration files as separate records, except for __ServerName__.
