![]() You can edit the templates as needed if you require to move the |CUSTOM| token to a different position in the VirtualHost.Īll tokens that are available for the VirtualHost will be available with this feature. The code you write will be inserted into the |CUSTOM| token for all VirtualHosts for this domain. The top textarea is where you will paste the custom nf code you wish to insert. If all domains need the changes, then you would repeat this process for each domain. Any changes made by this page will only affect the VirtualHosts for the domain in question, not the other domains owned by that user. It will contain all VirtualHosts for all domains, subdomains and redirects. Once you see the list of domains, click the domain you wish to insert the extra nf code for.Īt the bottom of the page, you'll see the current nf for that User. To access the control page for this functionality, go to Admin Panel -> Admin Settings -> Customize Httpd Configurations. More info on that here: open in new window # Adding custom nf code to the VirtualHostĭirectAdmin allows the Admin to insert extra nf code that a User may require. You can also run actual scripts with database queries, etc., (that is, if you wanted using the scripting portion of the templates). See the if-then-else link open in new window for more info on what else you can do with this basic scripting tool. You can trigger DirectAdmin to rewrite all User nf files by running: Once you are happy with your new virtual_host*.conf files, they'll need to be used in the real nf files. You can use tokens when assigning a value to CGI or DOCROOT, just use 'TOKEN' instead of |TOKEN|. The CAROOT token will be empty unless the User has added a valid CARootCertificate through DA. If the domain is suspended, the DOCROOT will be filled with the path of the suspended page. If CGI is not enabled, this line will be ignored and the CGI token will be empty. These lines are where the data for the CGI and DOCROOT tokens are set. The top of the templates should contain |?CGI=.| and |?DOCROOT=.|. The username of the account that created the User account who owns this domain The path of the certificate to be used for the domain The whole nf line used to load in the SSLCACertificateFile directive ![]() ( See Adding custom nf code the VirtualHost of one domain) The subdomain name (for the virtual_host_*sub.conf file) e.g., subĬustom nf code to be inserted if the _httpd file exists. This is the path that Apache will use to access the data when the ServerName () is requested The user's group name (99% of the time, it's the same as the USER) The whole nf line used to add the Script-Alias ON or OFF, if PHP safe_mode is enabled or not The IP address associated with that domain. These tokens are what will be replaced with specific user data for each domain created. Inside the virtual_host*.conf files, you'll find code that is similar to nf code, but contains what are known as tokens. The files with the 2 in them are for Apache 2.x. Note that there are actually 8 virtual_host files, but you only need to worry about the 4 that apply to you. Failure to copy the virtual_host2*.conf files to the custom directory before modifying them will result in a loss of all changes when DirectAdmin updates itself (because the files are overwritten). DirectAdmin will always check for the custom file before going to the default ones. Once you've copied the 4 VirtualHost files (or just the ones you want) to the custom directory, you can then edit the new files you've just copied. The 4 templates typically in question would be: ![]() In some cases, you will need to use a custom copy, but only if none of the options below work for you. We typically discourage relying on custom versions of these in case we make important changes to them, in which case you wouldn't inherit these changes. These are located in /usr/local/directadmin/data/templates/. Outlined below are the major sections to consider when deciding which method to use: Server Type: or: cust_nginx, cust_openlitespeed Should you know what you want to use, enter the info here: This guide will help you pick which method to use depending on what you need it to do. Note: For FreeBSD + chattr # CUSTOM HTTPD TEMPLATES: Starting pointĭirectAdmin offers a huge variety of ways to customize your User's VirtualHost entries. Don't forget to lock it again with chatter +i /etc/httpd/conf/nf after you're done.
0 Comments
Leave a Reply. |