PDA

View Full Version : How to add cutom Apache modules into EasyApache (WHM/cPanel) server?



Fli
05-01-2015, 11:54 PM
I wanted to install anti Slowloris protection and also Google page speed Apache module

So how i did it

here are supported custom modules: https://documentation.cpanel.net/display/EA/Custom+Modules

mod_ReqTimeout

so i downloaded "custom_opt_mod-reqtimeout.tgz" and added it onto WHM server into folder: /var/cpanel/easy/apache/custom_opt_mods/
then extracted:
tar xzf /var/cpanel/easy/apache/custom_opt_mods/custom_opt_mod-reqtimeout.tgz
removed archive:
rm /var/cpanel/easy/apache/custom_opt_mods/custom_opt_mod-reqtimeout.tgz
go to WHM »Service Configuration »Apache Configuration »Include Editor »Pre Virtualhost include » All versions
and add:

<IfModule mod_reqtimeout.c>

RequestReadTimeout header=20-40,MinRate=500 body=20-40,MinRate=500
</IfModule>



More about configuration parameters: https://httpd.apache.org/docs/trunk/mod/mod_reqtimeout.html

mod_pagespeed (i think it did not worked for me, there as errors in error log)

About module: https://developers.google.com/speed/pagespeed/module
The installation instructions are there: https://github.com/pagespeed/cpanel
im copying them here:

# /usr/local/cpanel/3rdparty/bin/git clone https://github.com/pagespeed/cpanel.git /tmp/pagespeed/
# cd /tmp/pagespeed/Easy;tar -zcvf Speed.pm.tar.gz pagespeed;mkdir -p /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy;mv Speed.pm Speed.pm.tar.gz -t /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy/;cd && rm -rf /tmp/pagespeed

then run easyapache in screen

# screen
# /scripts/easyapache
Continue to customize your Apache profile
Use arrow and Tab key to move in the menus
Show Exhaustive list of modules
Find mod_pagespeed and reqTimeout and tick it by "spacebar" key
Build easyapache
Ctrl+a+d to detach screen
screen -r to re-attach screen
exit to terminate screen and its processes

pagespeed config file after build complete: /usr/local/apache/conf/pagespeed.conf , i changed nothing

restart apache if not done so yet after apache build:
# service httpd restart