I don't understand.
service php-fpm start
php-fpm does not exist in /etc/rc.d or the local startup
Trying to serve php with php-fpm with nginx but failing
Note, this is my nginx.conf
at nginx.conf
service php-fpm start
php-fpm does not exist in /etc/rc.d or the local startup
Code:
php-fpm -v
PHP 8.3.23 (fpm-fcgi) (built: Jul 17 2025 01:12:18)
Copyright (c) The PHP Group
Zend Engine v4.3.23, Copyright (c) Zend Technologies
Note, this is my nginx.conf
at nginx.conf
Code:
#user nobody;
worker_processes 1;
# This default error log path is compiled-in to make sure configuration parsing
# errors are logged somewhere, especially during unattended boot when stderr
# isn't normally logged anywhere. This path will be touched on every nginx
# start regardless of error log location configured here. See
# [URL]https://trac.nginx.org/nginx/ticket/147[/URL] for more info.
#
#error_log /var/log/nginx/error.log;
#
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost; # Change this to your domain name or IP address
# Default web root
root /usr/local/www/nginx; # Or your desired web root, e.g., /usr/local/www/mywebsite.com
# Add index.php to the index directive so Nginx serves it automatically
index index.html index.htm index.php;
# Location block for static files (optional, but good practice)
location / {
try_files $uri $uri/ =404;
}
# Pass PHP scripts to PHP-FPM via TCP
location \ \.php$ {
alias /usr/local/www/nginx/;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000; # This is the crucial line for TCP socket
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; # Includes common FastCGI parameters
}
# Error pages
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
}
}
Last edited by a moderator: