Enabling HTTP2
Last updated: November 8th 2022
HTTP2 is becoming more and more widespread and is an improvement to the HTTP protocol which can make your sites load faster. HTTP2 only works on SSL secured (https) pages. HTTP2 configuration support will be added natively to Certbot at some point, so untill then we've decided to provide a guide here on how you can enable it manually on a typical Webdock stack.
HTTP2 support in Nginx
In Nginx it is very easy to enable HTTP2. First of all set your domains in Webdock, and then run Certbot in order to generate SSL certificates for your domains. You should now be able to edit /etc/nginx/sites-enabled/webdock and add http2 to the ssl listen directive:
listen 443 ssl http2; # managed by Certbot ...
Restart Nginx
sudo systemctl restart nginx
Now visit your https enabled site and bask in the glory of HTTP2
HTTP2 support in Apache
HTTP2 in Apache is slightly more involved. First set your domains and generate your SSL certificates with Certbot, just like with Nginx. Next execute the following command
sudo a2enmod http2
Next, edit the LetsEncrypt Certbot Apache config file at /etc/apache2/sites-enabled/000-default-le-ssl.conf and enter the correct Protocols line right after the <VirtualHost *:443> line, like so
<VirtualHost *:443> Protocols h2 h2c http/1.1 ServerName http2test.worf.webdock.io ServerAlias some-alias.myawesomesite.com ... </VirtualHost>
Finally restart Apache
sudo systemctl restart apache2
Now visit your https enabled site and bask in the glory of HTTP2
How do I know HTTP2 is working?
Using the Google Chrome Network Inspector and looking at the Protocol column you can ascertain whether your site is loading using HTTP2.
Look for h2 instead of http/1.1 and you know it's working! Remember HTTP2 only works over SSL, so it should show the :443 port in the Remote Address column.
Related articles
-
Webdock Performance Guarantee
In this article we define what our Performance Guarantee really means, and what you can expect from our hardware profiles as a customer.
Last updated: November 16th 2022
-
Webdock Server Benchmarks
Webdock is seriously fast. Click through to read more about how Webdock performs across our varying infrastructure.
Last updated: November 5th 2024
-
Setting Cache control headers for common content types Nginx and Apache
In this article we go through how to set correct Cache Control headers and best practices.
Last updated: November 8th 2022
-
How to Benchmark your server with ApacheBench
In this article we go through the commands you need to run in order to benchmark your server using ApacheBench as well as how you interpret the results.
Last updated: November 8th 2022
-
Enabling Brotli Compression
In this article we show how to enable Brotli compression. Brotli has shown compression ratios of up to 26% smaller than current methods, with less CPU usage.
Last updated: November 8th 2022
-
Load Balancing
Load Balancing with Webdock.
Last updated: November 8th 2022
-
Why Google Pagespeed or GTMetrix scores aren't as relevant as you think
In this article we discuss why Google Pagespeed and GTMetrix scores aren't as relevant an indicator of how good your website is as you might think.
Last updated: November 8th 2022
-
Optimizing Nginx for High Traffic Websites
Tweaking Nginx configuration for much better performance.
Last updated: July 19th 2023
-
Optimizing Apache for High Traffic Websites
Tweaking Apache configuration for much better performance.
Last updated: July 19th 2023