Jump to content

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


Recommended Posts

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>

[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>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.