So, I need to run multiple php apps/sites on one server. One or many should run using apache and mod_php5, and one or many should be able to run using mod_fastcgi and php-fpm. The mod_php5 ones are currently fine, and the fastcgi ones work if i disable mod_php5, but I'm having difficulty getting them to work at the same time.
I think this can be achieved using some combination of filesmatch, if.mod_fastcgi and if.mod_actions in apache, but I cant work out what it is. We can install any apache modules required to do this if needed.
Super bonus points if there is a different version of the vhost for Apache 2.2 or less and you have that snippet too, or at least know what I should do
Im not going to post the entire vhosts i have as i know they're wrong, but the first, default, mod_php based vhosts are looking like so...
#NameVirtualHost 127.0.0.1:80 < Apache 2.2 or less
<VirtualHost 127.0.0.1:80>
ServerAdmin webmaster@localhost
ServerName some.site.tld
DocumentRoot /var/www/some/site/
<Directory /var/www/some/site/>
Options Indexes FollowSymLinks MultiViews
Require all granted
# Order deny,allow < Apache 2.2 or less
# Allow from all < Apache 2.2 or less
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Ideally, I'd like these to remain untouched, and that we can add more if we need more of these.
The outcome I would like, is to be able to drop in new vhosts configured for mod_php using something like the first configuration, and also drop in vhosts like the following for fast cgi.
# NameVirtualHost 0.0.0.0:80 < Apache 2.2 or Less
<VirtualHost 0.0.0.0:80>
ServerAdmin webmaster@localhost
ServerName some.application.tld
DocumentRoot /opt/some/app/dir/
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
<IfModule mod_fastcgi.c>
# php_admin_flag engine off < I tried to use this to disable PHP
AddType application/x-httpd-fastphp5 .php
Action application/x-httpd-fastphp5 /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi_someapp
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi_someapp -socket /var/run/php5-fpm_ptbuild.sock -pass-header Authorization
<Directory /usr/lib/cgi-bin>
Options Indexes FollowSymLinks MultiViews ExecCGI
Require all granted
</Directory>
<Directory /opt/some/app/dir/>
#Options Indexes FollowSymLinks MultiViews ExecCGI
Require all granted
</Directory>
</IfModule>
# I tried to use the below alongside mod_php, didnt work
# <IfModule mod_php5.c>
# php_admin_flag engine off
# AddType application/x-httpd-fastphp5 .php
# <Directory /opt/some/app/dir/>
# Options Indexes FollowSymLinks MultiViews ExecCGI
# Require all granted
# </Directory>
# </IfModule>
</VirtualHost>
If you could post the second vhost, or tell me what I'm doing wrong, thanks very much in advance.