HTTP/2 is a significant improvement over HTTP/1.1, especially in the speed department. Apache supports HTTP/2 though it's disabled by default.
You can enable HTTP/2 for Apache by installing the http2 module and configuring Apache to serve requests using HTTP/2 instead of the default HTTP/1.1.
$ sudo a2enmod http2 #Ubuntu, Debian and SUSE Enabling module http2. To activate the new configuration, you need to run: systemctl restart apache2
Options | Debian, Ubuntu | openSUSE and SLES | Fedora Core, CentOS, RHEL | macOS | homebrew | xampp |
---|---|---|---|---|---|---|
a2enmod support | yes | yes | no | no | no | no |
Modules to install | none | |||||
Module name | n/a | http2 | ||||
Loadmodule directive | n/a | LoadModule http2_module <module_locations>/mod_http2.so |
<VirtualHost *:80> # ..... # .... Protocols h2 h2c http/1.1 </VirtualHost>
Related: Configuration options for HTTP/2
$ sudo systemctl restart apache2 #Ubuntu and Debian $ sudo systemctl restart httpd # CentOS and Red Hat
Related: How to manage Apache service
$ curl --http2 --head www.simplified.guide HTTP/1.1 101 Switching Protocols Upgrade: h2c Connection: Upgrade HTTP/2 200 date: Sun, 00 Jan 1900 00:00:00 GMT server: Apache/2.4.41 (Ubuntu) last-modified: Sat, 08 Feb 2020 14:15:13 GMT etag: W/"2aa6-59e11227347f6" accept-ranges: bytes content-length: 10918 vary: Accept-Encoding content-type: text/html
Comment anonymously. Login not required.