When I try to access
- domain.com/status/show or
- domain.com/status/ping,
I get following error in nginx:
2024/08/24 19:36:11 [error] 7448#0: *13203 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 15.16.2.54, server: domain.com, request: "GET /status/show HTTP/1.1", upstream: "fastcgi://unix:/usr/local/php74/sockets/domain.com:", host: "domain.com"
I am using same configurations on other server and it works without any problems. The only difference is there PHP version is PHP 8.2.
On this server with PHP 7.4 this same config does not work for some reason.
I tired lot of things, but nothing works and I am out of ideas.
Note I especially checked if status page exists prior PHP 8.0 and it exists from PHP 5.3.
My php-fpm config file is:
[domain.com]
user = www
group = www
listen = sockets/domain.com
listen.owner = www
listen.group = www
listen.mode = 0660
include = etc/common.conf
;access.format is in common
access.log = var/log/$pool.access.log
; The log file for slow requests
slowlog = var/log/$pool.slow.log
; The timeout for serving a single request after which a PHP backtrace will be
request_slowlog_timeout = 10s
common.conf
; Note: This value is mandatory.
pm = dynamic
pm.max_children = 800
;pm.start_servers = 8
pm.min_spare_servers = 16
pm.max_spare_servers = 32
pm.process_idle_timeout = 90s;
; The number of requests each child process should execute before respawning.
pm.max_requests = 10000
pm.status_path = /status/show
ping.path = /status/ping
access.format = "\"%R\" - %{REMOTE_ADDR}e - %{HTTP_CF_CONNECTING_IP}e - %u [%t] \"%m %r%Q%q\" \"%{REQUEST_URI}e\" %s %l %M %d"
nginx host
server {
listen 80;
listen 443 ssl http2;
server_name domain.com www.domain.com;
root /www/sites/domain.com;
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/usr/local/php74/sockets/domain.com;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
internal;
}
location ~ .\.php(/|$) {
fastcgi_pass unix:/usr/local/php74/sockets/domain.com;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~* ^/status/(show|ping)(/|$) {
fastcgi_pass unix:/usr/local/php74/sockets/domain.com;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
location / {
try_files $uri $uri/ $uri/index.php /index.php$is_args$query_string;
}
}
fastcgi.conf
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
#fastcgi_param HTTPS $https;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
It turns out, the configuration did not set following param:
Once I added it it worked normally.
Interesting this broke just this URL
/status/show
and nothing else.