3.2.7 How to enable HTTP/2 protocol

HTTP/2 protocol

The HTTP/2 protocol is a new version of the HTTP transport protocol for transferring website data. The work of almost all websites on the World Wide Web is based on this protocol. That is why so much attention is paid to it, and its speed, reliability and stability are so important. The main advantages of the new HTTP/2 protocol, compared to previous versions, are:

  • Accelerate data loading speed
  • Mandatory use of SSL/TLS encryption
  • Reducing the amount of data transferred over the network

As a substitute, the new HTTP/2 protocol is good in many ways. You can find more detailed information about the protocol on this page. Below we will look at methods for enabling support for this protocol on TheHost virtual hosting and any server where the Nginx web service is installed.

Enabling HTTP/2 protocol in hosting

If you use TheHost virtual shared hosting and you have connected an SSL certificate to your WWW domain, then the HTTP/2 protocol is already enabled by default and you do not need to do any additional actions to support it.

If you are using a dedicated IP address and have not previously activated HTTP/2, then to enable it you just need to check the appropriate box in the properties of your WWW domain:

Enable HTTP/2 protocol in WWW domain properties

Enabling HTTP/2 protocol on the NginX service

If you are using our servers with Ubuntu 16+ispmgr or Ubuntu 18+ispmgr templates, this is enabled by default. If you own your own server, where the web service NginX version 1.9.5 and higher is installed, the operating system Ubuntu 18.04 and higher and the package OpenSSL 1.0.2 and higher, then enabling HTTP/2 support will not be difficult for you.

To do this, under the superuser root, select the desired WWW domain and make sure that an SSL certificate is assigned to it. If there is no certificate, then you can add it using these instructions. After checking the SSL, click on the “Config” button, after selecting WWW domain:

Checking the installation of the SSL certificate and switching to manual configuration mode

In the Nginx tab that opens, replace the following construct:

listen "IP Address":443 ssl;

on

listen "IP Address":443 ssl http2;

and click on the “Save” button.

In our example below, we replaced

listen 176.114.4.120:443 ssl;

on

listen 176.114.4.120:443 ssl http2;

adding “http2” after the “ssl” directive:

Enable HTTP/2 in NginX configuration

If your server does not have an Isp manager control panel, all of the above can be done in the same way by making text edits in the Nginx config (usually /etc/nginx/nginx.conf) in the server block of the desired site and restart Nginx.