Jump to content


Photo

Apache2 VirtualHost Block -> ProxyPass fastcgi PHP-FPM + sub-directory w/ different ProxyPass ... how?


  • Please log in to reply
1 reply to this topic

#1 phpninja

phpninja
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 21 February 2017 - 10:03 PM

Apache2 VirtualHost Block -> ProxyPass fastcgi PHP-FPM + sub-directory w/ different ProxyPass ... how?

 

It seems like I have tried everything that I could think of. I tried putting a sub directory Directory directive in, with a secondary Proxy Pass, with no luck.

 

  ProxyPass fcgi://127.0.0.1:9071/home/exampledomain/public_html$1 (PHP 7.1.2)

  ProxyPass fcgi://127.0.0.1:9056/home/exampledomain/public_html$1 (PHP 5.6)

 

I need to use PHP 5.6 on a sub directory. Does anyone know how I can achieve this?

# VIRTUAL SERVER #
# TLD: exampledomain.com #
# Username: exampledomain #

# SSL #

<VirtualHost 10.1.1.100:443>
ServerName exampledomain.com
ServerAlias exampledomain.com
DocumentRoot /home/exampledomain/public_html
ErrorLog /home/exampledomain/exampledomain.com_ssl_error_log
CustomLog /home/exampledomain/exampledomain.com_ssl_access_log combined
ScriptAlias /cgi-bin/ /home/exampledomain/cgi-bin/
DirectoryIndex index.html index.php index.php4 index.php5 index.htm
<Directory /home/exampledomain/public_html>
Options -Indexes +FollowSymlinks
#allow from all
#AllowOverride None Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AllowOverride All
Require all granted
</Directory>
<Directory /home/exampledomain/cgi-bin>
#allow from all
#AllowOverride None Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AllowOverride All
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =www.exampledomain.com
RewriteRule ^(.*) https://exampledomain.com/ [R]
SSLEngine on
SSLCertificateFile /home/exampledomain/ssl.cert
SSLCertificateKeyFile /home/exampledomain/ssl.key
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
php_value memory_limit 64M
php_value suhosin.session.encrypt Off
<LocationMatch ^(.*\.php)$>
  ProxyPass fcgi://127.0.0.1:9071/home/exampledomain/public_html$1
</LocationMatch>
</VirtualHost>


#2 phpninja

phpninja
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 22 February 2017 - 07:14 PM

[SOLVED]

 

Directly under your main </Directory>

add this block (Top one is Everything , unless otherwise specified) and the second block is a designated sub directory with a custom PHP-FPM pass.

 

Port 9071 = PHP71-PHP-FPM

Port 9056 = RH-PHP56-PHP-FPM


<LocationMatch ^(.*\.php)$>
  ProxyPass fcgi://127.0.0.1:9071/home/exampledomain/public_html$1
</LocationMatch>
<LocationMatch ^/forum(.*\.php)$>
  ProxyPass fcgi://127.0.0.1:9056/home/exampledomain/public_html/forum$1
</LocationMatch>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users