ArjunCh
ArjunCh

Reputation: 1

How to enable http2 on CentOS7 with Apache 2.4.46

I have CentOS 7, with Apache 2.4.46. I have done pretty much every thing available on internet. I am getting the below error

The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.

My apache is running from /usr/local/apache2/.

I have seen, I may need to use php-fpm module to run this.

I have made changes on my live server and It is kinda stuck now. Though work impact is very less but I really want to learn what wrong am I doing

Upvotes: 0

Views: 2181

Answers (1)

Example person
Example person

Reputation: 3346

You would need to:

  • Disable mod_mpm_prefork
  • Disable mod_php (disable the php module, what ever it's named, example: libphp7)
  • Enable mod_mpm_event
  • Enable mod_http2
  • Enable mod_proxy
  • Enable mod_proxy_fcgi
  • Enable mod_setenvif
  • Install PHP-FPM using yum install php-fpm, or you might need to specify the version yum install php7-fpm or php8-fpm, and then start the PHP-FPM service after installation of that, using systemctl start php-fpm or php7-fpm/php8-fpm.
  • Add the following to Apache configuration:
    <FilesMatch "*\.php">
       SetHandler "proxy:fcgi://localhost:9000"
    </FilesMatch>
    
    If it is running as an UNIX socket, you would need to change it to:
    <FilesMatch "*\.php">
       SetHandler "proxy:unix:/path/to/php-fpm.sock|fcgi://localhost:9000"
    </FilesMatch> 
    
  • Restart Apache

Upvotes: 1

Related Questions