Welcome! Log In Create A New Profile

Advanced

PHP-FPM Integration driving me mad

Simon Hönscheid
July 30, 2016 04:46PM
Hello List,

due to a Server move, I was setting up a new nginx installation. Some of
the pages need php. So far nothing new. When I start adding
SCRIPT_FILENAME to the php location, it ends up that the script is no
longer found.


==> /var/log/nginx/www.example.com-error.log <==
2016/07/30 21:21:15 [error] 5546#5546: *1 FastCGI sent in stderr:
"Primary script unknown" while reading response header from upstream,
client: xx.xxx.xxx.xxx, server: www.example.com, request: "GET /info.php
HTTP/1.1", upstream: "fastcgi://unix:/var/run/fpmpool-www.socket:",
host: "www.example.com"

Do I leave it out, the script is handled but no output is retuned.(blank
white page) I'm debugging this now for hours and dont get any usable
result. Any help is appreciated.

Nginx: 1.10.1
PHP: 5.6.24
OS: Debian 8.5

nginx conf:

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
worker_rlimit_nofile 40960;
events {
use epoll;
worker_connections 4096;
}
http {
proxy_intercept_errors on;
fastcgi_intercept_errors on;
log_format main '';
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 5;
sendfile on;
keepalive_requests 150;
include /etc/nginx/sites-enabled/*;
include /etc/nginx/mime.types;
open_file_cache max=40960 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml application/xml
text/javascript application/x-javascript;
gzip_disable "MSIE [1-6]\.";
proxy_buffers 64 32k;
}

the server itself:

server {
server_name www.example.com;
listen xxx.xxx.xxx.xx:443 ssl http2;
access_log /var/log/nginx/www.example.com-access.log combined;
error_log /var/log/nginx/www.example.com-error.log notice;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_ciphers
EECDH+AESGCM:EDH+AESGCM:EECDH:EDH:MD5:!RC4:!LOW:!MEDIUM:!CAMELLIA:!ECDSA:!DES:!DSS:!3DES:!NULL;
charset utf-8;
index index.php index.html;
client_max_body_size 50M;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:5m;
ssl_dhparam /etc/nginx/dhparam.pem;
ssl_certificate
/opt/letsencrypt_certificates/nginx/www.example.com/fullchain.pem;
ssl_certificate_key
/opt/letsencrypt_certificates/nginx/www.example.com/privkey.pem;

location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
root /var/www/www.example.com;
}
location ~ \.php$ {
fastcgi_buffers 16 4k;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/fpmpool-www.socket;
include fastcgi_params;
}
}


PHP fpm config
[global]
pid = /var/run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
syslog.facility = daemon
syslog.ident = php-fpm
log_level = notice
emergency_restart_threshold = 0
emergency_restart_interval = 0
process_control_timeout = 0
include=/etc/php5/fpm/pool.d/*.conf


PHP pool config:

listen = /var/run/fpmpool-www.socket
listen.backlog = -1
listen.owner = www-data
listen.group = www-data
user = www-data
group = www-data
pm = dynamic
pm.max_children = 25
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 20
pm.max_requests = 500
pm.status_path = /fpm-status
ping.response = pong
request_terminate_timeout = 60s
request_slowlog_timeout = 0
slowlog = /var/log/php-fpm/www-slow.log
rlimit_files = 32000
rlimit_core = unlimited
catch_workers_output = yes


old PHP Location, on old server was:

location ~* \.php$ {
fastcgi_buffers 16 4k;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_URI http://$http_host$request_uri;
fastcgi_param SCRIPT_URL $request_uri;
fastcgi_param SERVER_NAME $http_host;
}

Kind Regards
Simon

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

PHP-FPM Integration driving me mad

Simon Hönscheid July 30, 2016 04:46PM

Re: PHP-FPM Integration driving me mad

Hamza Aboulfeth July 30, 2016 05:10PM

Re: PHP-FPM Integration driving me mad

Simon Hönscheid July 30, 2016 05:40PM

Re: PHP-FPM Integration driving me mad

Edho Arief July 30, 2016 05:46PM

[FIXED]PHP-FPM Integration driving me mad

Simon Hönscheid July 31, 2016 03:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 190
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready