There are a lot of ways in which you can customize your Apache configuration and it is up to you to pick the method that best suits your needs and specifications. But making changes to your Apache Host using your cPanel has never been easier with the help of EasyApache. This is an interface that installs, validates, and makes modifications to your different web servers, including Apache.
Customizing Apache configuration options
One of the ways to make changes in your Apache configuration is by using raw opts, more commonly known as custom configure flags. Advanced users may add these lines of data to a particular file on the server to modify the Apache build configuration. With EasyApache interface, it would be very easy for you to specify pattern options that are supported by Apache.
Another way you can customize Apache is by using .htaccess files. As you may know, every time Apache handles a request, it first looks for an .htaccess configuration file from the directory that holds the file being asked for or requested. If Apache finds that such .htaccess file exists and it can be read with no errors, Apache will utilize the contents of the file to make configuration changes to the requested application.
There are certain events that can bring about syntax assessment of the .htaccess file in a cPanel environment. When this happens, Apache might leave out some loaded modules during runtime. If there is an attempt to reference configured directives provided by the modules, a syntax error might appear. To prevent this from happening, you might want to wrap the configuration directives in a <IfModule></IfModule> block.
Customizing Global Apache configuration
If you are keen about making changes to the global Apache config, you can do it in a number of ways as well. First, you can do it via the Global Config interface of your WHM or web host manager. Just go to WHM’s Home screen then look for the Service Configuration Tab. From there, go to the Global Configuration section.
Manipulating the Global Apache configuration files can also be done through Include files in both the WHM and CLI (Command Line Interface). If you want to use the interface of WHM, just access the Include Editor tab and make the changes. However, if you decide to use CLI’s Include files, then just make the modifications in the files that can be found in /usr/local/apache/conf/includes. Restarting the Apache service with the command “service httpd restart” after you have customized an include file is an important step. So don’t forget it.
Customizing httpd.conf file directly
The httpd.conf file is quite a special file because it controls a lot of things in the Apache web server. This is where you can create default settings for web directories, enable modules, and more importantly make your virtual hosts. But this is one tricky file because there are things that can’t be modified in the Apache httpd.conf file. Any changes created to the default setting on the Control Panel VPS server are usually lost when the cPanel updates and regenerates its file.
If you must really make direct changes to this file, you have to follow these two steps:
The above distiller script will not modify the Apache configuration. This script simply brings the datastores in the /var/cpanel/userdata directory up to date. This means that there is no guarantee that the direct custom changes made in the httpd.conf file will not be overwritten.