7

After some research I cannot find answer for: How to update Apache/httpd to newest version to use HTTP/2 protocol on my VPS. I'm using PHP7 & my server based on Apache - CentOS 7.

No package updates on CentOS defaults repo.

[root@vps270238 ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Nov 19 2015 21:43:13

I really want to keep my actual settings and Virtual Hosts.

Damian Bartelmus
  • 101
  • 2
  • 2
  • 5

2 Answers2

11

You need Apache 2.4.18 or higher to enable HTTP/2, though some recommend a minimum of Apache 2.4.23 as lots of changes in mod_http2 since then (discussed further below). This also requires some 3rd party software (nghttp2 and a recent version of openssl)

The default repos from Centos are based on Red Hat which prioritises stability rather than latest features. So they often lag behind in versions (though are kept up to date with security patches - even though they leave the version number the same for this).

Additionally the mod_http2 module is still being changed a lot (almost daily if you look at its releases!), so is fairly cutting edge still - though not had any stability issues in months I've been running it.

For that reason, I personally think the best way to use http/2 on Apache is to compile the latest version from source. This is not without its risks of course. For a start you lose protection of the easy to update security patches mentioned above so may have to upgrade more frequently to stay on top of those (no bad thing in my opinion). Additionally you should verify source code before installing it (especially for an application such as Apache which runs, at least initially, as root). So it's not a decision to be taken lightly.

Saying that, if you wish to proceed, installing from source code is not as difficult as that sounds. I've a blog post on how to do it and also use Centos. I don't use PHP so not sure if you need any extra compile options for that.

Note also that by default Apache will install into /usr/local/apache2. This is good as it allows you to keep your original install (incase you need to roll back) but does mean you need to copy any config into /usr/local/apache2/conf, stop the old Apache (including in any startup scripts), and restart the new Apache from the new location.

Barry Pollard
  • 4,461
  • 14
  • 26
  • Thank you for answer. I can confirm that Red Hat holding Apache version as far as I read about it, I just thought there is a way to update php anyway with different repository. Maybe I will just wait for official release. About stability thing, php is way ahead with releases because of vulnerabilities. Anyway thanks again, I own you one. – Damian Bartelmus May 05 '16 at 13:53
0

Quick tip. Use nginx as reverse proxy and enable httpd/2 from it. And you will keep all your vhosts and htaccess.

x86fantini
  • 302
  • 1
  • 3
  • 9