Tamanho de download inconsistente com configuração PHP + NGINX

2

Estou construindo um site Joomla usando o docman para gerenciamento / download de documentos. O site é construído em um servidor Ubuntu 14.04 executando Nginx 1.4.2 e PHP5 (FPM).

O problema que estou tendo é que os arquivos estão sendo baixados de forma inconsistente (em termos de tamanho). Por exemplo, baixei um arquivo PDF 6 vezes do site com os seguintes resultados:

  • 72 KB
  • 75 KB
  • 146 KB
  • 177KB (arquivo completo)
  • 72 KB
  • 177KB (arquivo completo)

para este teste, o arquivo completo foi baixado corretamente 2 de 6 vezes. As outras 4 vezes o arquivo estava incompleto.

Meu nginx.conf se parece com isso

user       www-data;
worker_processes  1;
error_log  logs/error.log;
worker_rlimit_nofile 8192;

events {
        worker_connections  4096;
}

http {
        include    /etc/nginx/conf/mime.types;
        include    /etc/nginx/proxy.conf;
        include    /etc/nginx/fastcgi.conf;
        index    index.php app.php index.html index.htm;
        default_type application/octet-stream;
        log_format   main '$remote_addr - $remote_user [$time_local]  $status '
        '"$request" $body_bytes_sent "$http_referer" '
        '"$http_user_agent" "$http_x_forwarded_for"';
        access_log   logs/access.log  main;
        sendfile     on;
        tcp_nopush   on;
        server_names_hash_bucket_size 128; # this seems to be required for some vhosts

        keepalive_timeout 0;

        #GZIP#
        gzip on;
        gzip_http_version 1.1;
        gzip_comp_level 6;
        gzip_min_length 1100;
        gzip_buffers 4 8k;
        gzip_types text/plain application/xhtml+xml text/css application/xml application/xml+rss text/javascript application/javascript application/x-javascript
        gzip_proxied     any;
        gzip_disable     "MSIE [1-6]\.";

        include /etc/nginx/sites-enabled/*;

A configuração do site é semelhante à seguinte:

server {
        listen 80;
        server_name example.com;
        server_name_in_redirect off;

        access_log /var/log/nginx/localhost.access_log main;
        error_log /var/log/nginx/localhost.error_log info;

        root /www/sites/canmore.link/html;
        index index.php index.html index.htm default.html default.htm;
        # Support Clean (aka Search Engine Friendly) URLs
        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        # deny running scripts inside writable directories
        location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
                return 403;
                error_page 403 /403_error.html;
        }

        location ~ \.php$ {
                        include fastcgi_params;
                        fastcgi_read_timeout 300;
                        fastcgi_intercept_errors on;
                        fastcgi_pass 127.0.0.1:9000;
        }


        # caching of files
        location ~* \.(ico|pdf|flv)$ {
                expires 1y;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
                expires 14d;
        }

}

Aqui está o link

do arquivo de log

2015/11/15 23:51:06 [info] 16075#0: *1 recv() failed (104: Connection reset by peer) while sending to client, client: 24.64.69.223, server: canmore.link, request: "$
2015/11/15 23:51:07 [crit] 16075#0: *3 open() "/var/lib/nginx/fastcgi/1/00/0000000001" failed (13: Permission denied) while reading upstream, client: 24.64.69.223, $
2015/11/16 00:24:09 [info] 16228#0: *68 recv() failed (104: Connection reset by peer) while sending to client, client: 24.64.69.223, server: canmore.link, request: $
2015/11/16 00:24:10 [crit] 16228#0: *70 open() "/var/lib/nginx/fastcgi/1/00/0000000001" failed (13: Permission denied) while reading upstream, client: 24.64.69.223,$
2015/11/16 00:31:46 [info] 16262#0: *1 recv() failed (104: Connection reset by peer) while sending to client, client: 24.64.69.223, server: canmore.link, request: "$
2015/11/16 00:31:53 [crit] 16262#0: *5 open() "/var/lib/nginx/fastcgi/1/00/0000000001" failed (13: Permission denied) while reading upstream, client: 24.64.69.223, $
2015/11/16 00:38:24 [error] 16318#0: *4 open() "/www/sites/canmore.link/html/favicon.ico" failed (2: No such file or directory), client: 24.64.69.223, server: canmo$
2015/11/16 00:38:24 [info] 16318#0: *1 client prematurely closed connection, so upstream connection is closed too while sending request to upstream, client: 24.64.6$
2015/11/16 00:38:51 [info] 16318#0: *17 client 24.64.69.223 closed keepalive connection (104: Connection reset by peer)
2015/11/16 00:38:52 [crit] 16318#0: *14 open() "/var/lib/nginx/fastcgi/3/00/0000000003" failed (13: Permission denied) while reading upstream, client: 24.64.69.223,$
2015/11/16 00:38:55 [crit] 16318#0: *13 open() "/var/lib/nginx/fastcgi/4/00/0000000004" failed (13: Permission denied) while reading upstream, client: 24.64.69.223,$
2015/11/16 00:39:23 [info] 16360#0: *1 recv() failed (104: Connection reset by peer) while sending to client, client: 24.64.69.223, server: canmore.link, request: "$
2015/11/16 00:39:23 [crit] 16360#0: *3 open() "/var/lib/nginx/fastcgi/1/00/0000000001" failed (13: Permission denied) while reading upstream, client: 24.64.69.223, $
2015/11/16 00:40:33 [info] 16388#0: *44 recv() failed (104: Connection reset by peer) while sending to client, client: 24.64.69.223, server: canmore.link, request: $
2015/11/16 00:40:34 [crit] 16388#0: *46 open() "/var/lib/nginx/fastcgi/1/00/0000000001" failed (13: Permission denied) while reading upstream, client: 24.64.69.223,$
2015/11/16 00:40:44 [crit] 16388#0: *48 open() "/var/lib/nginx/fastcgi/2/00/0000000002" failed (13: Permission denied) while reading upstream, client: 24.64.69.223,$
    
por Jonathan Coe 16.11.2015 / 00:47

1 resposta

0

Problema resolvido com base no arquivo de log ...

Alterei as permissões na pasta / var / lib / nginx / fastcgi e funcionou.

chown -R www-data /var/lib/nginx/fastcgi
    
por 16.11.2015 / 01:54