Skip to content
Home / Apache / Minimal PHP FPM Apache setup

Minimal PHP FPM Apache setup

Just enough setup to get Your site running with PHP FPM.

Let’s assume we have working instance of PHP 7.4 with FPM installed on our server. We need to set Apache to handle PHP files by listening FPM socket:

<FilesMatch \.php$>
     SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost/"
</FilesMatch>

Our final minimal working setup with some error logging should look like this:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com
    <FilesMatch \.php$>
     SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost/"
    </FilesMatch>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>