0

Ubuntu 16.04.1 Apache/2.4.18 PHP 5.6.32

I am trying to make a separate pool for each virtual host. So I created site1.config in /etc/php/5.6/fpm/pool.d:

[site1]
user = site1
group = site1
listen = /var/run/php/php5.6-fpm-site1.sock
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

When I restart the FastCGI server, I see the processes being created. So far, so good! Then I create /etc/apache2/sites-available/site1.config:

<VirtualHost *:80>
    ServerName site1.com
    ServerAlias www.site1.com

    ServerAdmin webmaster@localhost
    DocumentRoot /data/site1/html
    <Directory /data/site1/html>
            AllowOverride All
            Options -MultiViews
            Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <IfModule mod_fastcgi.c>
        AddType application/x-httpd-fastphp5 .php
        Action application/x-httpd-fastphp5 /php5-fcgi
        Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi-site1
        FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi-site -socket /var/run/php/php5.6-fpm-site1.sock -pass-header Authorization
    </IfModule>
</VirtualHost>

After restarting Apache I can access the virtual host at site1.com but in the environment section of phpinfo I see that the user is still www-data. Any ideas? Thanks in advance.

  • Are you sure you're running php 5.6? Ubuntu 16.04 has php 7.0. Which would put the config at `/etc/php/7.0/fpm/pool.d/` – virullius Jan 11 '18 at 18:09
  • @mjb2kmn Yes, I am :) – Martin Dimitrov Jan 11 '18 at 19:27
  • you don't need to check environment, a simple ps should tell you which user is running the fpm pool. site1 user exists? – ezra-s Jan 12 '18 at 00:29
  • @ezra-s Yes, 2 processes with `site1` user were created right after I restarted the `fpm` service. But this, in my opinion, doesn't mean `Apache` is using this particular pool. I've tested it by allowing only `site1` to read the `phpinfo.php` file. I received 500 error from `Apache`. – Martin Dimitrov Jan 12 '18 at 07:49
  • and what does the error log say when you receive 500? If the answer is "nothing" then the error is not from apache but from php. – ezra-s Jan 12 '18 at 11:44
  • @ezra-s The user is `www-data`, the default `php-fpm` user. The error log says that this user has no permission to open the requested file. – Martin Dimitrov Jan 12 '18 at 15:22
  • fix the permissions then – ezra-s Jan 14 '18 at 04:24
  • @ezra-s Well, I don't want to do this. I want to make Apache use the `site1`'s pool. – Martin Dimitrov Jan 15 '18 at 07:08
  • @MartinDimitrov check apache config and make sure you are landing in the appropiate virtualhost. Show "apachectl -S" output. – ezra-s Jan 15 '18 at 15:38

0 Answers0