Skip to end of metadata
Go to start of metadata

Overview

EasyApache provides multiple methods that you can use to customize your Apache configuration.

Important:

  • Make certain that you only use the methods below to modify your Apache configuration. If you use a method that we do not support, cPanel & WHM and EasyApache can overwrite your custom configuration.
  • We strongly recommend that you read the Apache Configuration documentation before you customize your Apache configuration.

Warning:

Currently, we no longer develop EasyApache 3 and only release security updates. We have tentatively scheduled EasyApache 3 for deprecation at some point in 2018. You will receive at least three months notification prior to official deprecation. After that time, EasyApache 3 will no longer receive any updates. For more information, read our cPanel Long-Term Support documentation.

We strongly recommend that you upgrade to EasyApache 4. For more information, read our EasyApache 4 documentation. 

Featured documentation

  EasyApache 3

IntroductionFAQ

Change Log Release Notes  

ProfilesCustomization

Tomcat

Migrate from Tomcat 5.5 to 7

How to Deploy Java Applications

Important:

EasyApache 3 does not support Tomcat for new installations. EasyApache 4 does not support Tomcat and we do not plan to provide support in the future. 

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 /usr/local/apache/conf/userdata/ directory.
  • 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 virtualhost tag. 

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 Raw Opts documentation.

.htaccess files

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 <IfModule></IfModule> block.

 

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

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 Global 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 Include Editor 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 /usr/local/apache/conf/includes/ directory.

Important:

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 Modify Virtualhost Containers With Include Files documentation.

Modify the httpd.conf file directly

Warning:

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:

  1. Make the necessary changes to your httpd.conf file.
  2. Run the Apache configuration distiller script as the root user with the following command:

    /usr/local/cpanel/bin/apache_conf_distiller --update

Important:

The Apache configuration distiller script does not make changes to your Apache configuration. The distiller script updates the datastores in the /var/cpanel/userdata directory.

The Apache configuration distiller script does not guarantee that cPanel & WHM will not overwrite your direct modifications to your httpd.conf file.

To test whether cPanel & WHM will overwrite your modifications, perform the following steps:

  • Create a copy of your httpd.conf file with your direct modifications.
  • Run the /scripts/rebuildhttpdconf script to rebuild your httpd.conf file. If your changes are still present in your httpd.conf file, 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 Custom Templates documentation.