0

I have multiple virtual hosts with unique domain names, users, and root directories for each on Nginx and php8.1-fpm.

In the /etc/php/8.1/fpm/pool.d/domain.com.conf contains

user = domainuser group = domainuser listen = /var/run/php/php8.1-domain.com-fpm.sock 

Virtual host file /etc/nginx/sites-available/domain.com.vhost

server { listen 80; listen [::]:80; root /var/www/domain.com; index index.php index.html index.htm; server_name domain.com www.domain.com; location / { try_files $uri $uri/ =404; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php8.1-domain.com-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } access_log /var/log/nginx/domain.com.access.log; error_log /var/log/nginx/domain.com.error.log; } 

When I run ls -l /var/run/php, it only shows one socket file, and the other 5 are missing.

srw-rw---- 1 www-data www-data 0 Oct 29 12:48 php8.1-domain.com-fpm.sock 

Error log:

2023/10/29 12:56:50 [crit] 627#627: *3 connect() to unix:/var/run/php/php8.1-domain.com-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 20.163.15.11, server: domain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-domain.com-fpm.sock:", host: "domain.com" 

Each virtual host has a unique user, group, socket location, and root directory. All users are added to the www-data group.

0

1 Answer 1

2

You need to put every site into its own pool, otherwise the config files just override each other.

[Site1] user = domainuser group = domainuser listen = /var/run/php/php8.1-domain.com-fpm.sock 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.