HTTP/2 is the upgraded version of the Hypertext Transfer Protocol. It enables faster, more efficient communication between browsers and servers by allowing multiple files to load at once through a single connection.
But to benefit from it, your server must be properly configured. Whether you’re running Apache or NGINX, here’s how to enable HTTP/2 step by step.
What Is HTTP/2
HTTP/2 is a new upgrade from HTTP/1.1. It introduces multiplexing, which lets browsers load several files simultaneously over a single connection. This reduces latency and makes your site feel faster and smoother.
Keep in mind: HTTP/2 only works over HTTPS, so make sure your domain already has a valid SSL certificate installed before proceeding.
Enabling HTTP/2 on Apache
If you’re running Apache version 2.4.17 or newer, it only takes a few steps.
- Activate the required modules:
sudo a2enmod http2 sudo a2enmod ssl - Edit your SSL configuration file:
Open the configuration file for your site, typically located in:
/etc/apache2/sites-available/ Within the <VirtualHost *:443> block, add:
Protocols h2 http/1.1 - Restart Apache:
sudo systemctl restart apache2 Once restarted, your Apache server will start communicating over HTTP/2.
Enabling HTTP/2 on NGINX
For NGINX version 1.9.5 or newer (compiled with OpenSSL), the setup is equally simple.
- Modify your SSL server block:
Locate your SSL configuration and modify the listen directive to include HTTP/2:
listen 443 ssl http2; - Test your configuration:
Before reloading, test your configuration to avoid syntax errors:
sudo nginx -t - Reload NGINX:
If everything looks fine, reload NGINX:
sudo systemctl reload nginx Your NGINX server now supports HTTP/2 connections.
How to Check If HTTP/2 Is Working
Once configured, verify that HTTP/2 is active. You can:
- Open your browser’s Network tab and inspect the protocol column.
- Or use this simple command:
curl -I –http2 https://yourdomain.com
If the response includes HTTP/2 200, congratulations – it’s working perfectly.
Quick Tips for Smooth Setup
- Enable SSL first: HTTP/2 only functions over HTTPS.
- Use Let’s Encrypt: It’s a reliable and free SSL option.
- Test after changes: Always verify configurations before restarting services.
Performance Optimization
To push your performance even further, consider pairing HTTP/2 with Contabo Object Storage or LiteSpeed. Both enhance resource efficiency and improve website responsiveness under heavy load.
Watch Our Video on Enabling HTTP/2
If you prefer a visual walk-through, you can see the exact setup process for both Apache and NGINX in action – from configuration to verification on our YouTube.
Final Assessment
Enabling HTTP/2 is one of the simplest yet most impactful upgrades you can make for your website. With just a few configuration changes, your server becomes faster, more secure, and ready for modern web standards.