Nginx has become a household name when it comes to web servers and its (about time) “recent” integration to cPanel officially by cPanel developers it has become one of the most used HTTP servers used today (it’s mostly used as a reversed cache proxy in cPanel / WHM case).

But yet again cPanel devs decided to not use some of its basic functions – one of those being HTTP2, a new (way faster) standard of serving websites that have been in mass usage for the past 5 years (read more about it on Wikipedia). The “on/off” feature has been requested by server admins on cPanel forums for a better part of a year but we have yet to see the light of this feature. It’s a good thing it’s very easy to enable it manually.

To enable this globally, add a new file ending in .conf (I call mine http2.conf) to the Nginx configuration folder located in /etc/nginx/conf.d and add the lines bellow. I have recently become lazy with Putty so I’m using WinSCP for this.

server {

listen 443 ssl http2;
listen [::]:443 ssl http2;

}

Yes, copy ‘n paste it with the spaces, and save the file.

Now just check if everything if OK with;

nginx -t

If everything states “OK”, proceed with restarting Nginx and PHP-FPM:

/scripts/restartsrv_nginx ; /scripts/restartsrv_apache_php_fpm

That’s it. Now the simplest way to check if everything is working is to mosey on to a HTTP2 checker, check out the results and enjoy your faster sites. If you want to be 1337 you can also check this out by opening up your terminal and typing;

curl --head https://yourwebsite.com

The reply will be something like this:

HTTP/2 301 Moved Permanently
Server: nginx
Date: Fri, 11 Nov 2022 12:11:07 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 232
Connection: keep-alive
Location: https://www.yourwebsite.com
Cache-Control: max-age=3600
Expires: Fri, 11 Nov 2022 13:00:06 GMT

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.