Problem with fpm php (wrong script location ?!)

nginx_dig nginx-forum at nginx.us
Mon Feb 27 19:39:06 UTC 2012


Hi,

first of all: i am fairly new to nginx (used apache for several years
now)....
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! :D ), 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 
/websites/some.domain/http$fastcgi_script_name;"
even with document_root$fastcgi_script_name ...

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







My relevant config data:



in my vhost config file:
########

server {
	listen 256.256.256.256:80;      #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 
/websites/some.domain/http$fastcgi_script_name;
    	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
exploits)
        fastcgi_pass    backend_php;     # The upstream determined
above
    }
        


}
}

######
in nginx.conf:

user  www www;
worker_processes  1;
 
# main server error log
error_log	/var/log/nginx/error.log ;
pid	/var/run/nginx.pid;
 
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          256.256.256.256:80 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 {
    		server 127.0.0.1:9000;
	}

}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,223072,223072#msg-223072



More information about the nginx mailing list