Custom directives outside of a VirtualHost tag

Includes and the Include Editor

When your EasyApache profile is rebuilt using a different version of Apache, changes made to the configuration file will be replaced with their default values to ensure a working configuration.

If you would like to keep your changes through a rebuild wherein the Apache version changes, you can use custom include files, eliminating the need for you to directly edit httpd.conf. WHM features an editor for these include files. This interface can be accessed at Main::Service Configuration::Apache Configuration::Include Editor.

PICK Important: This is the preferred method of making changes to httpd.conf.

Virtually any Apache directive can be added through the Include Editor. However, you should make sure that your changes are syntactically valid.

.htaccess files

When Apache processes a request, it scans the directory containing the requested file, in search of the .htaccess configuration file. If such a file exists and is readable by Apache, Apache will use its contents to modifying the configuration for handling the request. Please see http://httpd.apache.org/docs/2.2/howto/htaccess.html for more information about using .htaccess.

Some events in a cPanel environment will trigger a syntax check of a .htaccess file. During the check, Apache will not know about any modules that are loaded at runtime. Reference to configuration directives provided by these modules will produce syntax errors during this check. To prevent this, you must wrap such directives in an <IfModule></IfModule> block.

Example:

<IfModule mod_suphp.c>
    suPHP_ConfigPath /etc
</IfModule> 

The Apache Config Distiller

If you do decide to make direct edits to httpd.conf, most changes outside of a VirtualHost directive can be preserved easily using the config distiller tool:

  1. Make your desired changes to httpd.conf.
  2. Run the following script:
    • /usr/local/cpanel/bin/apache_conf_distiller --update --main
  3. To verify that your changes were properly stored, run the following script:
    • /scripts/rebuildhttpdconf

Custom Templates

ALERT! Warning: Custom templates will require a fair amount of upkeep.

Custom templates can be used to include information into the httpd.conf file. The information contained within a custom template file is processed by the Template Toolkit, http://template-toolkit.org, and will automatically be updated with information from the datastores used by the configuration system.

Apache 1 templates should be placed at /var/cpanel/templates/apache1/main.local. You should copy /var/cpanel/templates/apache1/main.default to /var/cpanel/templates/apache1/main.local.

Apache 2 templates should be placed at /var/cpanel/templates/apache2/main.local. You should copy /var/cpanel/templates/apache2/main.default to /var/cpanel/templates/apache2.main.local.

However, it is important to remember that, once you create a custom template, the EasyApache system will no longer preserve changes made outside of the VirtualHost directives in httpd.conf. The Apache config distiller only updates the main.default template.

For more information about custom templates, please visit our documentation here.

PICK Remember: The changes made within a custom template will require the proper tags, blocks, and directives and will require these elements to be syntactically sound.

Topic revision: r8 - 03 Mar 2010 - 18:41:23 - Main.MelanieSeibert
EasyApache3.OutsideVHost moved from Sandbox.OutsideVHost on 08 Jun 2009 - 14:51 by Main.JustinSchaefer - put it back
 

Copyright © cPanel 2000-2010.