Problem with fpm php (wrong script location!)


first of all: i am fairly new to nginx (used apache for several years
Works great, except fpm php…
In the last 24h i have read many tutorials, forum posts and howtos…

First there was no error message at all…just a blank page (many others
were getting that too).

Now after some changes i get an error message (horray! :smiley: ), but i have
no clue how to fix this.

2012/02/27 20:23:10 [error] 26226#0: *1 open()
“/usr/local/etc/nginx/html/info.php” failed (2: No such file or
directory), client

That is not the normal document root.

All normal (html ,text e.g.) files are beeing delivered just fine out of
my document root.
But why is he looking at another directory to geht this php script ?!

I tried many variants of " fastcgi_param SCRIPT_FILENAME
even with document_root$fastcgi_script_name …

Nothing worked.
Any ideas ho to change the looking directory to the document root ? The is exisitng in there.

My relevant config data:

in my vhost config file:

server {
listen; #just an example ip
server_name .some.domain;

    location / {
        root   /websites/some.domain/http;
        index  index.php index.html index.htm;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/local/www/nginx-dist;

    location ~ /\.ht {
        deny  all;

location ~ .php$ {
root html;
fastcgi_split_path_info ^(.+.php)(.*)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;

  if (-f $request_filename) {
    # Only throw it at PHP-FPM if the file exists (prevents some PHP

fastcgi_pass backend_php; # The upstream determined


in nginx.conf:

user www www;
worker_processes 1;

main server error log

error_log /var/log/nginx/error.log ;
pid /var/run/;

events {
worker_connections 1024;

main server config

http {
server_names_hash_bucket_size 64;
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”’;

sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;

server {
listen default;
server_name _;
access_log /var/log/nginx/access.log main;

server_name_in_redirect off;

      location / {
            index index.html;
            root  /usr/local/www/nginx;


# virtual hosting
include /usr/local/etc/nginx/vhosts/*;

upstream backend_php {


Posted at Nginx Forum:

Just another addition:

I tried to set the root parameter again to an absolut value…
No i am getting an empty page again when calling the php script.

(access log shows a normal 200)


Posted at Nginx Forum:

location / {
root /websites/some.domain/http;
index index.php index.html index.htm;

Try to move this main root out of location / {} block to the server {}

server {

server_name …;
root …;


Also, root should ALWAYS point to an absolute path.


Posted at Nginx Forum: