All articles
TutorialsJan 26, 2026 · 4 min read

How to Enable HTTP/2 on Your Server

How to Enable HTTP/2 on Your Server

HTTP/2 makes websites faster. It allows multiple requests over a single connection, compresses headers, and enables server push. If you're still running HTTP/1.1, you're leaving performance on the table.

Here's how to enable HTTP/2 on the most common server setups.

Prerequisites

HTTP/2 requires HTTPS. If you don't have SSL configured yet, set that up first. Let's Encrypt makes this free and straightforward.

Nginx

Nginx has supported HTTP/2 since version 1.9.5. Enabling it takes one line change.

Open your server block configuration:

sudo nano /etc/nginx/sites-available/default

Find your listen directive and add http2:

server { listen 443 ssl http2; listen [::]:443 ssl http2; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/key.pem; # ... rest of config }

Test and reload:

sudo nginx -t sudo systemctl reload nginx

Apache

Apache 2.4.17+ supports HTTP/2 through mod_http2.

Enable the module:

sudo a2enmod http2

Add the protocol directive to your virtual host:

<VirtualHost *:443> Protocols h2 h2c http/1.1 SSLEngine on SSLCertificateFile /path/to/cert.pem SSLCertificateKeyFile /path/to/key.pem # ... rest of config </VirtualHost>

Restart Apache:

sudo systemctl restart apache2

Caddy

Caddy enables HTTP/2 by default. If you're using Caddy, you're already done. It also handles SSL automatically.

example.com { root * /var/www/html file_server }

That's it. HTTP/2 and HTTPS are enabled out of the box.

LiteSpeed

LiteSpeed also enables HTTP/2 by default on HTTPS connections. No configuration needed.

To verify it's working, check the LiteSpeed admin panel under Configuration → Server → Tuning → Enable HTTP/2.

Verifying HTTP/2

Once configured, verify it's working:

Browser DevTools: Open Chrome DevTools, go to the Network tab, right-click the header row, and enable "Protocol". You should see h2 for HTTP/2 connections.

Command line:

curl -I --http2 https://yourdomain.com

Look for HTTP/2 200 in the response.

Online tools: KeyCDN HTTP/2 Test gives you a quick check.

Common issues

HTTP/2 not working despite configuration:

  • Make sure you're testing over HTTPS, not HTTP
  • Check that your SSL certificate is valid
  • Verify the server software version supports HTTP/2

Mixed protocol issues:

  • Some older proxies or load balancers don't support HTTP/2
  • If you're behind Cloudflare or another CDN, HTTP/2 might be handled at their edge

PHP-FPM conflicts (Apache):

  • If using mod_php, switch to php-fpm for better HTTP/2 compatibility
  • mod_php and mod_http2 can conflict on prefork MPM

Performance tips

HTTP/2 changes some best practices:

  • Stop concatenating files. HTTP/2's multiplexing makes bundling less beneficial
  • Stop domain sharding. Multiple domains hurt HTTP/2 performance
  • Use server push carefully. It can waste bandwidth if overused

Need a server that's already optimized? Our VPS plans come with modern web servers pre-configured for HTTP/2 and HTTP/3. Check out our options.