How to enable HTTP2 on WHM/cPanel with EasyApache 4

How to enable HTTP2 on WHM/cPanel with EasyApache 4

In this tutorial we are going to provide you with step-by-step instructions on how to enable HTTP2  on a CentOS 7 VPS with WHM/cPanel and EasyApache 4 installed on it. HTTP2 is a major revision of the HTTP network protocol and its goal is to reduce the latency as well as to make the web applications faster by allowing multiple concurrent requests between the web browser and the server across a single TCP connection.

Log in to WHM

Log in to WHM at https://your_server_IP:2087 and go to Home >> Software >> EasyApache 4 >> Customize >> PHP versions and install php 7.x version (php70, php71 or php72). Also, it is a good idea to install the following PHP extensions:

php7x-php-bz2 
php7x-php-curl 
php7x-php-gd 
php7x-php-mbstring 
php7x-php-mcrypt 
php7x-php-mysqlnd 
php7x-php-zip

Click on ‘Next’, review the changes and click on ‘Provision’.

Then, go to Home >> Software >> MultiPHP Manager and set PHP 7 as the default PHP version for your websites.

Enable HTTP2 via WHM:

Log in to WHM and go to Home >> Software >> EasyApache 4 >> Customize >> Apache modules, disable the mod_mpm_prefork if it is enabled, click on ‘review’ to review the changes and click on ‘Provision’.

Then, go to Home >> Software >> EasyApache 4 >> Customize >> Apache modules , search for ‘mod_http2’ module, and enable it:

Do you want to proceed with this selection? Yes

Click on ‘Next’ , and click on ‘Provision’ to install and enable the ‘mod_http2’ Apache module.

Enable HTTP2 via command line:

You can also install mod_http2 Apache module on the command line using the following commands:

# yum clean all

# yum shell
Loaded plugins: universal-hooks
> remove ea-apache24-mod_mpm_prefork
> install ea-apache24-mod_mpm_worker
> install ea-apache24-mod_http2
> run

--> Running transaction check
---> Package ea-apache24-mod_http2.x86_64 0:2.4.27-6.6.1.cpanel will be installed
---> Package ea-apache24-mod_mpm_prefork.x86_64 0:2.4.27-6.6.1.cpanel will be erased
--> Processing Dependency: ea-apache24-mpm = forked for package: ea-apache24-mod_cgi-2.4.27-6.6.1.cpanel.x86_64
---> Package ea-apache24-mod_mpm_worker.x86_64 0:2.4.27-6.6.1.cpanel will be installed
--> Processing Dependency: ea-apache24-mod_cgid for package: ea-apache24-mod_mpm_worker-2.4.27-6.6.1.cpanel.x86_64
--> Running transaction check
---> Package ea-apache24-mod_cgi.x86_64 0:2.4.27-6.6.1.cpanel will be erased
---> Package ea-apache24-mod_cgid.x86_64 0:2.4.27-6.6.1.cpanel will be installed
--> Finished Dependency Resolution

=============================================================================================================================================================================================================================================
 Package                                                               Arch                                             Version                                                         Repository                                      Size
=============================================================================================================================================================================================================================================
Installing:
 ea-apache24-mod_http2                                                 x86_64                                           2.4.27-6.6.1.cpanel                                             EA4                                            190 k
 ea-apache24-mod_mpm_worker                                            x86_64                                           2.4.27-6.6.1.cpanel                                             EA4                                             42 k
Removing:
 ea-apache24-mod_mpm_prefork                                           x86_64                                           2.4.27-6.6.1.cpanel                                             @EA4                                            31 k
Installing for dependencies:
 ea-apache24-mod_cgid                                                  x86_64                                           2.4.27-6.6.1.cpanel                                             EA4                                             39 k
Removing for dependencies:
 ea-apache24-mod_cgi                                                   x86_64                                           2.4.27-6.6.1.cpanel                                             @EA4                                            27 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install  2 Packages (+1 Dependent package)
Remove   1 Package  (+1 Dependent package)

Total download size: 271 k
Is this ok [y/d/N]: y

You should see something like this:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
httpd started successfully.
Setting /home permissions to 0711......Done
Setting permissions for.....virtualthings …
laravelvirtualth …
...Done
  Verifying  : ea-apache24-mod_http2-2.4.27-6.6.1.cpanel.x86_64                                                                                                                                                                          1/5
  Verifying  : ea-apache24-mod_cgid-2.4.27-6.6.1.cpanel.x86_64                                                                                                                                                                           2/5
  Verifying  : ea-apache24-mod_mpm_worker-2.4.27-6.6.1.cpanel.x86_64                                                                                                                                                                     3/5
  Verifying  : ea-apache24-mod_mpm_prefork-2.4.27-6.6.1.cpanel.x86_64                                                                                                                                                                    4/5
  Verifying  : ea-apache24-mod_cgi-2.4.27-6.6.1.cpanel.x86_64                                                                                                                                                                            5/5

Removed:
  ea-apache24-mod_mpm_prefork.x86_64 0:2.4.27-6.6.1.cpanel

Dependency Removed:
  ea-apache24-mod_cgi.x86_64 0:2.4.27-6.6.1.cpanel

Installed:
  ea-apache24-mod_http2.x86_64 0:2.4.27-6.6.1.cpanel                                                                 ea-apache24-mod_mpm_worker.x86_64 0:2.4.27-6.6.1.cpanel

Dependency Installed:
  ea-apache24-mod_cgid.x86_64 0:2.4.27-6.6.1.cpanel

Finished Transaction

Enter quit to exit the yum shell:

 quit
Leaving Shell

Please make sure that there is a /etc/apache2/conf.d/http2.conf Apache configuration file with the following lines:

cat  /etc/apache2/conf.d/http2.conf
<IfModule http2_module>

LogLevel http2:info

Protocols h2 h2c http/1.1

</IfModule>

If there is no such file, create it, add the lines above and restart Apache for the changes to take effect:

service httpd restart

Please note, most browsers only support HTTP/2 via encrypted (https) connections, so you need to have a valid SSL certificate installed on your website to see the benefits of the HTTP2 protocol.

That is it. HTTP2 is enabled on your cPanel server.

If you have a managed VPS with us, there is no need to enable HTTP2 on WHM/cPanel with EasyApache 4 yourself. Instead, you can ask our Linux Administrators to install these for you. They are available 24/7 and can help you out with any issues or requests that you have.

P.S. If you like our blog posts, on how to enable HTTP2 on WHM/cPanel with EasyApache 4,  we’d appreciate you sharing this post on social networks by using the shortcuts below, or you can post a comment under the share shortcuts. Thanks.

1 thought on “How to enable HTTP2 on WHM/cPanel with EasyApache 4”

Leave a Comment