A
A
Aleks_ja2013-05-30 15:39:53
PHP
Aleks_ja, 2013-05-30 15:39:53

Nginx + PHP-FPM - sometimes showing blank pages?

Faced with a strange problem - empty pages are periodically given.
Error logs are silent, as if everything is fine.
The Access log looks like this: my.ip.address. - - [29/May/2013:16:24:25 +0100] "GET /my_page_url/ HTTP/1.1" 200 5 "/my_page_url/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:21.0) Gecko /20100101 Firefox/21.0"rv:21.0) Gecko/20100101 Firefox/21.0"
That is, the status returned is 200, and the content length is only 5!
The problem either stops itself with time. Or immediately after restarting php-fpm. as we understand it is php-fpm Software
versions are:
RedHat 5.8
PHP 5.3.24 (fpm-fcgi) (built: Apr 12 2013 10:13:38)
Nginx nginx/0.8.55
What could it be?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
6
6uxou, 2013-05-30
@6uxou

Check the configs of NGINX itself and its host. Perhaps the error lies there.
It's also worth asking, are you trying to call a normal static HTML in my_page_url or a PHP script? If the first, then the problem is in NGINX/Configuration itself.

6
6uxou, 2013-05-30
@6uxou

Try with this configuration:

server {
  server_name  moysait.ru;
  
  # opt-in to the future  
  charset utf-8;
  add_header "X-UA-Compatible" "IE=Edge,chrome=1";
  
  root  /var/www/moysait.ru/httpdocs;

  location / {
    index  index.html index.htm index.php;
    try_files $uri $uri/ /index.php?q=$uri&$args;
  }

  location ~ \.php$ {
    try_files  $uri = 404;
    fastcgi_pass unix:/tmp/php.sock;
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
  }
}

PS: Just don't forget to change the paths. If it does not work, write in a personal, I will help.

C
crazyASD, 2013-05-30
@crazyASD

Lacks php-fpm handlers apparently. Increase or decrease the number of nginx connections

A
Andrey Burov, 2013-05-30
@BuriK666

and look at dmesg, maybe FPM processes are falling ...

6
6uxou, 2013-05-31
@6uxou

Alternatively:
Check not only the number of PHP-FPM workers, but also the size of FastCGI buffers and timeouts.
Here is a part of the config that I once successfully used in NGINX in the http { } section:

## Size Limits
client_max_body_size          128m;
client_body_buffer_size       128k;
client_header_buffer_size     1k;
large_client_header_buffers   4 4k;

## Timeouts 
client_body_timeout   5;
client_header_timeout 5;
keepalive_timeout     5;
send_timeout          5;
#reset_timedout_connection  on; 

## General Options
ignore_invalid_headers  on;
recursive_error_pages   on;
sendfile                on;
aio                     on;
output_buffers          2 128k;
server_name_in_redirect off;
server_tokens           off;

## TCP options  
tcp_nodelay on;
tcp_nopush on;

## Compression
gzip              on;
gzip_static       on;  
gzip_proxied      any;
gzip_min_length   1;
gzip_buffers      16 8k;
gzip_comp_level   5;
gzip_http_version 1.1;
gzip_types        text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
gzip_vary         on;
gzip_disable      "MSIE [1-6]\.";
gzip_proxied      expired no-cache no-store private auth;    

## Fast CGI
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;

Hope this helps you figure out your problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question