0

Im trying to enable http2 h2c in my website under ubuntu 18.04 and apache2, but it isnt working. heres what i have done

  1. use MPM-event instead of prefork
  2. Add protocols to 000-default.conf
    <VirtualHost *:80>
        ServerName 167.71.149.xxx
        DocumentRoot /var/www/php56/folder1
        Protocols h2c http/1.1
        <Directory /var/www/php56/folder1>
            Options -Indexes +FollowSymLinks +MultiViews
            AllowOverride All
            Require all granted
        </Directory>
        <FilesMatch \.php$>
            # Apache 2.4.10+ can proxy to unix socket
            SetHandler "proxy:unix:/var/run/php/php5.6-fpm.sock|fcgi://localhost"
        </FilesMatch>
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined

            <IfModule mod_dir.c>
                DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
            </IfModule> 
     </VirtualHost>

  1. Restart apache

But im receiving the http/1.1 headers using chrome (up to date) and dont know what to check for

Just did

 curl -I -k --http2 http://167.71.149.xxx/

HTTP/1.1 101 Switching Protocols Upgrade: h2c Connection: Upgrade

HTTP/2 200 date: Thu, 01 Jan 1970 00:00:00 GMT server: Apache/2.4.29 (Ubuntu) content-type: text/html; charset=UTF-8

Ricardo Mehr
  • 101
  • 1

2 Answers2

1

Verify that you enabled the HTTP/2 module with

$ a2enmod http2
$ apache2ctl -M | grep http2
 http2_module (shared)

The protocols line should read:

Protocols h2 h2c http/1.1
fuero
  • 9,591
  • 1
  • 35
  • 40
0

But im receiving the http/1.1 headers using chrome (up to date) and dont know what to check for

Browsers only support HTTP/2 over HTTPS: https://stackoverflow.com/questions/34076231/why-do-browser-implementations-of-http-2-require-tls

Barry Pollard
  • 4,591
  • 15
  • 26