Запуск Symfony на Apache2.4 с mod_proxy_fcgi (Ubuntu 16.04)

Возможно, потребуется установка пакетов

sudo apt-get install libapache2-mod-php7.0
sudo apt-get install libapache2-mod-fastcgi
sudo apt-get install  php-fpm

Включаем соответствующие модули Apache:

sudo a2enmod proxy proxy_fcgi

Настраиваем виртуальный хост, как сказано здесь:

<VirtualHost *:80>
    ServerName domain.tld
    ServerAlias www.domain.tld

    # Uncomment the following line to force Apache to pass the Authorization
    # header to PHP: required for "basic_auth" under PHP-FPM and FastCGI
    #
    # SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1

    # For Apache 2.4.9 or higher
    # Using SetHandler avoids issues with using ProxyPassMatch in combination
    # with mod_rewrite or mod_autoindex
    <FilesMatch \.php$>
        SetHandler proxy:fcgi://127.0.0.1:9000
    </FilesMatch>

    # If you use Apache version below 2.4.9 you must consider update or use this instead
    # ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/project/web/$1

    # If you run your Symfony application on a subpath of your document root, the
    # regular expression must be changed accordingly:
    # ProxyPassMatch ^/path-to-app/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/project/web/$1

    DocumentRoot /var/www/project/web
    <Directory /var/www/project/web>
        # enable the .htaccess rewrites
        AllowOverride All
        Require all granted
    </Directory>

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeeScript assets
    # <Directory /var/www/project>
    #     Options FollowSymlinks
    # </Directory>

    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>

В файле /etc/php/7.0/fpm/pool.d/www.conf заменить строку

listen = /run/php/php7.0-fpm.sock

строкой

listen = 127.0.0.1:9000

Далее выполнить инструкции пункта 3. Using ACL on a System that Supports setfacl (Linux/BSD)
из раздела http://symfony.com/doc/current/setup/file_permissions.html:

 HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1`

 sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
 sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var

После всех изменений перезапустить apache и php-fpm:

sudo /etc/init.d/php7.0-fpm restart
sudo service apache2 restart

Возможно, эти действия помогут исправить ошибку в логах apache:

Got error 'PHP message: PHP Fatal error: Uncaught RuntimeException: Unable to create the cache directory