Customize VHost Configuration in DirectAdmin

You are here:
< Back

You can customize OpenLiteSpeed Virtual Host configuration in DirectAdmin. Despite the misleading name, Custom HTTPd Configurations on the DA Console may be used to add, modify, or edit an OLS virtual host configuration, when OLS is running. The customized changes you make will not be overwitten the next time DA CustomBuild is run to upgrade OLS.

When you place code in *Custom HTTPd Configuration*, files are created in /usr/local/directadmin/data/users/$USER/domains/domain.com.cust_openlitespeed*. These code blocks are always inserted into /usr/local/directadmin/data/users/$USER/openlitespeed.conf, and should not be edited directly, as DirectAdmin updates will overwrite any changes.

To get started, navigate to DirectAdmin Control Panel > Server Manager > Custom HTTPD Configurations. Select openlitespeed.conf for the virtual host to be modified (in this case, da-ols):

The OLS virtual host configuration will be displayed. Click the CUSTOMIZE button to edit it, and save when you’re finished.

As an example, if you’d like to define a customized 404 error page for that domain, you would add this content to the text box:

Note:

CUSTOM1: Appears at the very top of the template, before setting the variables.

CUSTOM2: Appears in scripthandler{} section.

CUSTOM3: Appears in ALL context{} sections, used for password protected directories.

CUSTOM4: Appears in phpIniOverride{} section.

CUSTOM5: Appears in rewrite{} section.

CUSTOM6: Appears in vhssl{} section.

CUSTOM7: The very last entry.

CUSTOM8:

 

After saving, you will see a /usr/local/directadmin/data/users/$USER/domains/domain.com.cust_openlitespeed file created with the following content:

errorpage 404 {
  url                     /404.html
}

The new content will also have been inserted into /usr/local/directadmin/data/users/$USER/openlitespeed.conf.