php fastcgi main/common config
Artifex Maximus
artifexor at gmail.com
Mon Oct 18 13:21:55 MSD 2010
Hello!
On Thu, Oct 14, 2010 at 1:56 PM, Reinis Rozitis <r at roze.lv> wrote:
>> Have tried but gives http error 404 to all php script. I had changed
>> fastcgi_params, rearrange conf as you outlined. In brief:
>
> Can you compare (change) your fastcgi_params file to this and see if it
> works then (be sure to restart nginx too)?:
>
> 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 REQUEST_URI $request_uri;
> fastcgi_param DOCUMENT_URI $document_uri;
> fastcgi_param DOCUMENT_ROOT $document_root;
> fastcgi_param SERVER_PROTOCOL $server_protocol;
> 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 $host;
I have copied this lines to my fastcgi_params and changed the
nginx.conf to the suggested one. My file had this line
fastcgi_param SERVER_NAME $server_name;
instead of yours.
I recompile nginx with debug feature to look deeper into
communication. On php request nginx found the required php related
config lines:
'2010/10/18 11:07:51 [debug] 45041#0: *1 using configuration "\.php$"'
But the document root variable is bad for some reason:
'2010/10/18 11:07:51 [debug] 45041#0: *1 http script copy: "SCRIPT_FILENAME"
2010/10/18 11:07:51 [debug] 45041#0: *1 http script var:
"/usr/local/etc/nginx/html"
2010/10/18 11:07:51 [debug] 45041#0: *1 http script var:
"/www/php/getplugins.php"
2010/10/18 11:07:51 [debug] 45041#0: *1 fastcgi param:
"SCRIPT_FILENAME: /usr/local/etc/nginx/html/www/php/getplugins.php"
2010/10/18 11:07:51 [debug] 45041#0: *1 http script copy: "SCRIPT_NAME"
2010/10/18 11:07:51 [debug] 45041#0: *1 http script var:
"/www/php/getplugins.php"'
It uses /usr/local/etc/nginx/html as document root instead of my
/www/site1. How could I define the document root for php scripts?
Bye,
a
More information about the nginx
mailing list