Dario Zadro
Dario Zadro

Reputation: 1284

Multiple PHP Pools for SAME User - Nginx Upstream on Debian

I'm trying to take advantage of nginx upstream using socket but receiving errors in my log:

connect() to unix:/var/run/user_fpm2.sock failed (2: No such file or directory) while connecting to upstream

I might be going about this wrong and looking for some advice/input.

Here's the nginx conf block:

upstream backend {
    server unix:/var/run/user_fpm1.sock;
    server unix:/var/run/user_fpm2.sock;
    server unix:/var/run/user_fpm3.sock;
}

And:

location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass backend;
        fastcgi_index index.php;
        include fastcgi_params;
}

Then, I have 3 PHP pools at /etc/php/7.0/fpm/pool.d/ that look pretty much the same as below. The only difference between the pools is _fpm1, _fpm2, and _fpm3 to match the upstream block.

[user]

listen = /var/run/user_fpm1.sock
listen.owner = user
listen.group = user
listen.mode = 0660
user = user
group = user
pm = ondemand
pm.max_children = 200
pm.process_idle_timeout = 30s
pm.max_requests = 500
request_terminate_timeout = 120s
chdir = /
php_admin_value[session.save_path] = "/home/user/_sessions"
php_admin_value[open_basedir] = "/home/user:/usr/share/pear:/usr/share/php:/tmp:/usr/local/lib/php"

I've noticed the /var/run always ONLY has the user_fpm3.sock file.

Am I going about this wrong? Is it possible to make this upstream config work? All advice and critique welcome.

I'm running PHP7 on Debian Jessie with nginx 1.10.3 - Server has 6 CPU's and 12GB RAM.

Thanks in advance.

UPDATE: I figured the answer myself, but leaving the question in case someone else is trying to do the same thing, or there's a way to optimize this further.

All I had to do was change my pool names to [user_one], [user_two], and [user_three]

Upvotes: 1

Views: 898

Answers (1)

Dario Zadro
Dario Zadro

Reputation: 1284

Changing the the name of each PHP pool fixed the problem, like so:

[user_one]

[user_two]

[user_three]

Upvotes: 1

Related Questions