Skip to content

Virtual Host Customization in DirectAdmin

You can add, modify, or edit a custom OpenLiteSpeed Virtual Host configuration in DirectAdmin using the Custom HTTPd Configurations area.

Warning

The only way to safely modify a vhost configuration is through the Custom HTTPd Configurations area. These changes will not be overwritten during CustomBuild upgrades.

Do not directly modify the configuration files found at /usr/local/directadmin/data/users/$USER/domains/domain.com.cust_openlitespeed* or /usr/local/directadmin/data/users/$USER/openlitespeed.conf, as such changes will be overwritten.

To get started, navigate to DirectAdmin Control Panel > Server Manager > Custom HTTPD Configurations. Click openlitespeed.conf for the virtual host to be modified. (In our pictured example, we are modifying a domain called da-ols.)

The OLS virtual host configuration will be displayed.

Click the CUSTOMIZE button to edit the configuration, and SAVE your changes when you're finished.

Custom 404 Page

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:

errorpage 404 {
  url                     /404.html
}

If you wanted to, you could also use the CUSTOM tokens provided by DirectAdmin, like so:

  • CUSTOM1: Appears at the very top of the template, before setting the variables.
  • CUSTOM2: Appears in the scripthandler{} section.
  • CUSTOM3: Appears in ALL context{} sections, used for password protected directories.
  • CUSTOM4: Appears in the phpIniOverride{} section.
  • CUSTOM5: Appears in the rewrite{} section.
  • CUSTOM6: Appears in the vhssl{} section.
  • CUSTOM7: The very last entry.

Press the SAVE button when you are done.

Your changes will be reflected in the /usr/local/directadmin/data/users/$USER/domains/domain.com.cust_openlitespeed file. The new content will also have been inserted into /usr/local/directadmin/data/users/$USER/openlitespeed.conf.