H
H
homm2012-02-18 20:40:56
PHP
homm, 2012-02-18 20:40:56

Php5-fpm and nginx - does not want to work in any?

I bet who knows how long. It seems that I set up such a bunch more than once, but now something is wrong and it’s not clear what.
A blank page is returned. And with the code 200 if the file exists, and 404 if not. In Anginix, fastcgi_pass is set for the "/" location. $document_root/test.php is passed to SCRIPT_FILENAME. I know about the joke of redefining SCRIPT_FILENAME in include fastcgi_params, I took it into account. The file test.php exists, it contains the content "123", it has read and execute access for everyone. Fpm is already running as the home user, not www-data, so that there are certainly rights.
Both Anginix and fpm have debug logging enabled. At the same time, in the nginx logs, it is clear that the request for fpm is coming. The file is requested the same, there are no errors in the path, I checked ls -l. Everything looks like the empty response is actually coming from fpm. The answer also includes X-Powered-By. But the fpm log (/var/log/php5-fpm.log) is empty, the last line is always fpm_event_loop(), line 254: ready to handle connections.
I tried to turn off fpm, put Janga in fastcgi on the same port - it works. Disabled gzip in Anginix.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
ertaquo, 2012-02-18
@homm

Maybe you should try this? Or, if it doesn't help, try adding this line to fastcgi_params:
server {
listen 192.168.56.100:80;
server_name .flat.ubuntu;
root /home/homm/www/project_dev/www;
location / {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9030;
fastcgi_param SCRIPT_FILENAME $document_root/test.php;
}
}

fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;

Z
zuborg, 2012-02-18
@zuborg

Register proxying to a tcp socket (not to a unix socket) and look at the traffic with a sniffer, you will know exactly what request nginx sends and what response php returns:
tcpdump -nAs 20000 -i lo0 tcp port 9000

M
mastini, 2012-02-19
@mastini

why go to /fastcgi at all?
Take it out as a separate location.
location ~ .php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
include fastcgi_params;
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_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question