How it works
EasyApache builds your global Apache configuration from the following components:
- Global templates — EasyApache uses the global configuration templates in the
/usr/local/apache/conf/includes/directory to create your global Apache configuration.
- The modules, options, and extensions that EasyApache builds by default for your version of Apache.
- The EasyApache options that you select.
EasyApache builds each
virtualhost tag from the following components:
- Any custom templates in the subdirectories that are within the
/var/cpanel/templates/2_2/and /var/cpanel/templates/2_4/ directories.
- Account information for each domain — When you make a configuration change to an account or domain in the cPanel or WHM interfaces, cPanel & WHM changes the content of the appropriate file in the
- Additional templates for each domain — EasyApache includes the files in the appropriate
/usr/local/apache/conf/userdata/directory for each domain to build the configuration of each
Modify the configuration options for Apache
To modify the configuration options for your Apache build, use raw opts. Raw opts are also known as custom configure flags.
Raw opts are lines of data that advanced users can add to a specific file on the server in order to customize the configuration of Apache or PHP builds. EasyApache allows you to specify any configuration option supported by Apache and/or PHP.
For more information on raw opts, read our Advanced Apache Configuration documentation.
When Apache processes a request, it searches for an
.htaccess configuration file inside the directory that contains the requested file. If the
.htaccess file exists and is readable by Apache, Apache will use its contents to modify the configuration for the request. For more information about how to use
.htaccess, read Apache’s HTTP Server Tutorial.
Some events in a cPanel & WHM environment will trigger a syntax check of a
.htaccess file. When it runs the check, Apache will skip any modules that loaded at runtime. Any attempt to reference configuration directives that these modules provide will produce syntax errors. To prevent these errors, you must wrap those directives inside an
<IfModule></IfModule> block. The following is an example of an
Modify your global Apache configuration
To modify your global Apache configuration, use one of the following methods:
Modify the Apache configuration directives via WHM
To modify Apache's global configuration directives that cPanel & WHM builds by default, use WHM's Advanced Apache Configuration interface (Home >> Service Configuration >> Apache Configuration >> Global Configuration).
Modify the Apache configuration files with include files via WHM
To modify the Apache configuration's include files view WHM, use WHM's Advanced Apache Configuration interface (Home >> Service Configuration >> Apache Configuration >> Include Editor).
Modify the Apache configuration with include files via CLI
To modify the Apache configuration's include files via the command line interface (CLI), edit the appropriate configuration files in the
After you modify an include file, make certain that you restart the Apache service with the
service httpd restart command.
Modify the content of specific virtualhosts
You can use the CLI to add include files that modify the content of the virtualhost containers in your Apache configuration. You may wish to do this to modify the configuration of an individual domain or a specific user's domains. For more information on how to modify your virtualhost containers with include files, read our Advanced Apache Configuration documentation.
Modify the httpd.conf file directly
We do not recommend that you use this method. cPanel & WHM or EasyApache may overwrite your changes.
If you must modify your
httpd.conf Apache configuration file directly, perform the following steps:
- Make the necessary changes to your
Run the Apache configuration distiller script as the
rootuser with the following command:
The Apache configuration distiller script does not make changes to your Apache configuration. The distiller script updates the datastores in the
The Apache configuration distiller script does not guarantee that cPanel & WHM will not overwrite your direct modifications to your
To test whether cPanel & WHM will overwrite your modifications, perform the following steps:
- Create a copy of your
httpd.conffile with your direct modifications.
- Run the
/scripts/rebuildhttpdconfscript to rebuild your
httpd.conffile. If your changes are still present in your
httpd.conffile, then cPanel & WHM will not overwrite your modifications.
Change how cPanel & WHM writes virtualhosts
You can use custom templates to change the default content of each virtualhost container. For more information on custom templates, read our Advanced Apache Configuration documentation.