cPanel administrators can log into WebHost Manager (WHM) and enable HTTP/2 with EasyApache4 with a slider. Unmanaged server administrators don’t have that pretty graphical interface for this task, excluding maybe those using Webmin, Vesta Control Panel, or another system administration interface.
Regardless, it is still a quick, straight-forward process to enable HTTP/2 support on Apache web servers. Below we’ll cover how to:
This article does not apply to NGINX servers.
Enable HTTP/2 in Apache
- SSH into your server as the root user.
- Ensure you have Apache installed (Ubuntu/CentOS) and the version is at least 2.4. Otherwise, you’ll need to upgrade Apache.
- Ensure you have a valid SSL certificate installed on your server so you can use force secure (HTTPS) connections. If you need one, you can use the free Certbot Let’s Encrypt SSL application on Ubuntu 18.04.
snapdis not compatible with our Cloud Server Hosting at this time. However, there are many other Let’s Encrypt SSL providers including SSLforFree.com and ZeroSSL.com that may suit your needs.
- Enable the HTTP/2 Apache module:
- Edit your Apache virtual host configuration file with your preferred text editor – e.g. Nano, Emacs, VIM, etc. If you have an SSL installed, the file should end with
le-ssl. One of the following should work depending on your server environment:
sudo nano /etc/apache2/sites-enabled/domainname-le-ssl.confsudo nano /etc/apache2/sites-enabled/000-default-le-ssl.conf
- Add the following text in the configuration file directly underneath
Protocols h2 http/1.1
- Save changes.
- Restart Apache:
If you have issues configuring HTTP/2 at any time, you can always request technical support from our Managed Hosting team.
Verify HTTP/2 Support
After reconfiguring Apache, you’ll need to use browser developer tools or third party extensions to verify that your website is using HTTP/2. The fastest option is to use an online tool such as the KeyCDN HTTP/2 test tool.
Linux terminal users can use the following command to check if their website is using HTTP/2:
curl --http2 domain.com -I
The response should start with
localhost instead of the domain or server hostname while logged into SSH may not work.
If you want to stay ahead on website performance, look out for the upcoming HTTP/3 protocol. As of November 2020, Firefox, Chrome, Edge, and Safari support HTTP/3. However, Safari is the only web browser with HTTP/3 support enabled by default. Meanwhile, native Nginx HTTP/3 support is expected to come in the 1.19 release.
Looking for other ways to improve website performance? Learn more about how to secure your Linux cloud server.
Learn more from our Cloud Server Hosting Product Guide.