Answer the question
In order to leave comments, you need to log in
Question about configuring pool in Apache + php-fpm environment?
Hello.
I'm trying to separate sites into different pools so that hacking one site does not lead to automatic access to others through the webshell.
I'm currently training on 2 sites out of several.
My configs:
/etc/apache2/mods-enabled/fastcgi.conf
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
FastCgiIpcDir /var/lib/apache2/fastcgi
AddHandler php-fcgi .php .php5
<FilesMatch \.php$>
SetHandler php5-fcgi
</FilesMatch>
<Location "/fastcgiphp">
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
</Location>
Action php5-fcgi /fastcgiphp
Action php5-fastcgi /fastcgiphp
</IfModule>
[eva]
user = eva-pool
group = eva-pool
listen = /var/run/eva-php5-fpm.sock
listen.owner = eva-pool
listen.group = www-data
listen.mode = 0660
[rec]
user = rec-pool
group = rec-pool
listen = /var/run/rec-php5-fpm.sock
listen.owner = rec-pool
listen.group = www-data
listen.mode = 0660
<VirtualHost *:80>
ServerName test.ru
DocumentRoot /var/www/eva
<IfModule mod_fastcgi.c>
FastCgiExternalServer /usr/local/bin/eva-fpm -socket eva-php5-fpm.sock
Alias /fastcgiphp /usr/local/bin/eva-fpm
</IfModule>
</VirtualHost>
<VirtualHost *:80>
ServerName test2.ru
DocumentRoot /var/www/rec
<IfModule mod_fastcgi.c>
FastCgiExternalServer /usr/local/bin/rec-fpm -socket rec-php5-fpm.sock
Alias /fastcgiphp /usr/local/bin/rec-fpm
</IfModule>
Answer the question
In order to leave comments, you need to log in
I commented out the entire /etc/apache2/mods-enabled/fastcgi.conf
I installed proxy_fcgi
In the corresponding virtual host I wrote:
<FilesMatch ".*\.php$">
SetHandler "proxy:unix:/var/run/rec-php5-fpm.sock|fcgi://localhost/"
</FilesMatch>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question