Nginx + PHP-FPM no Centos 6.5 me fornece 502 Bad Gateway (erro fpm: não é possível ler o que uma criança diz: descritor de arquivo incorreto)

2

Estou configurando uma pilha LEMP padrão. Minha configuração atual está me dando o seguinte erro:

502 Gateway inválido

Isso é o que está atualmente instalado no meu servidor:

Aquiestãoasconfiguraçõesquecriei/atualizeiatéagora,alguémpodedarumaolhadanoseguinteeverondeoerropodeestar?Eujáverifiqueimeuslogs,nãohánadalá( link ). E vi o seguinte no arquivo /var/log/php-fpm/error.log .

sidenote: o nginx e o php-fpm foram configurados para serem executados em uma conta local chamada www-data e as seguintes pastas saem do servidor

nginx.confconfiguraçãoglobaldonginx

userwww-data;worker_processes6;worker_rlimit_nofile100000;error_log/var/log/nginx/error.logcrit;pid/var/run/nginx.pid;events{worker_connections2048;useepoll;multi_accepton;}http{include/etc/nginx/mime.types;default_typeapplication/octet-stream;#cacheinformationsaboutFDs,frequentlyaccessedfilescanboostperformanceopen_file_cachemax=200000inactive=20s;open_file_cache_valid30s;open_file_cache_min_uses2;open_file_cache_errorson;#toboostIOonHDDwecandisableaccesslogsaccess_logoff;#copiesdatabetweenoneFDandotherfromwithinthekernel#fasterthenread()+write()sendfileon;#sendheadersinonepeace,itsbetterthensendingthemonebyonetcp_nopushon;#don'tbufferdatasent,goodforsmalldataburstsinrealtimetcp_nodelayon;#serverwillcloseconnectionafterthistimekeepalive_timeout60;#numberofrequestsclientcanmakeoverkeep-alive--fortestingkeepalive_requests100000;#allowtheservertocloseconnectiononnonrespondingclient,thiswillfreeupmemoryreset_timedout_connectionon;#requesttimedout--default60client_body_timeout60;#ifclientstopresponding,freeupmemory--default60send_timeout60;#reducethedatathatneedstobesentovernetworkgzipon;gzip_min_length10240;gzip_proxiedexpiredno-cacheno-storeprivateauth;gzip_typestext/plaintext/csstext/xmltext/javascriptapplication/x-javascriptapplication/xml;gzip_disable"MSIE [1-6]\.";

    # Load vHosts
    include /etc/nginx/conf.d/*.conf;
}

conf.d / www.domain.com.conf minha entrada vhost

## Nginx php-fpm Upstream
upstream wwwdomaincom {
    server unix:/var/run/php-fcgi-www-data.sock;
}

## Global Config
client_max_body_size            10M;
server_names_hash_bucket_size   64;

## Web Server Config
server
{
    ## Server Info
    listen 80;
    server_name domain.com *.domain.com;
    root /home/www-data/public_html;
    index index.html index.php;

    ## Error log
    error_log /home/www-data/logs/nginx-errors.log;

    ## DocumentRoot setup
    location / {
        try_files $uri $uri/ @handler;
        expires 30d;
    }

    ## These locations would be hidden by .htaccess normally
    #location /app/                       { deny all; }

    ## Disable .htaccess and other hidden files
    location  /. {
        return 404;
    }

    ## Magento uses a common front handler
    location @handler {
        rewrite / /index.php;
    }

    ## Forward paths like /js/index.php/x.js to relevant handler
    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }

    ## Execute PHP scripts
    location ~ \.php$ {
        try_files $uri =404;
        expires        off;
        fastcgi_read_timeout 900;
        fastcgi_pass   wwwdomaincom;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    ## GZip Compression
    gzip on;
    gzip_comp_level 8;
    gzip_min_length 1000;
    gzip_proxied any;
    gzip_types text/plain application/xml text/css text/js application/x-javascript;
}

/etc/php-fpm.d/www-data.conf minha configuração do pool do php-fpm

## Nginx php-fpm Upstream
upstream wwwdomaincom {
    server unix:/var/run/php-fcgi-www-data.sock;
}

## Global Config
client_max_body_size            10M;
server_names_hash_bucket_size   64;

## Web Server Config
server
{
    ## Server Info
    listen 80;
    server_name domain.com *.domain.com;
    root /home/www-data/public_html;
    index index.html index.php;

    ## Error log
    error_log /home/www-data/logs/nginx-errors.log;

    ## DocumentRoot setup
    location / {
        try_files $uri $uri/ @handler;
        expires 30d;
    }

    ## These locations would be hidden by .htaccess normally
    #location /app/                       { deny all; }

    ## Disable .htaccess and other hidden files
    location  /. {
        return 404;
    }

    ## Magento uses a common front handler
    location @handler {
        rewrite / /index.php;
    }

    ## Forward paths like /js/index.php/x.js to relevant handler
    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }

    ## Execute PHP scripts
    location ~ \.php$ {
        try_files $uri =404;
        expires        off;
        fastcgi_read_timeout 900;
        fastcgi_pass   wwwdomaincom;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    ## GZip Compression
    gzip on;
    gzip_comp_level 8;
    gzip_min_length 1000;
    gzip_proxied any;
    gzip_types text/plain application/xml text/css text/js application/x-javascript;
}

Eu tenho um arquivo em /home/www-data/public_html/index.php com o código <?php phpinfo(); ?> (arquivo enviado como usuário www-data ).

    
por Latheesan 01.06.2014 / 21:21

1 resposta

1

nginx tmp dir não é gravável pelo usuário nginx está sendo executado como, no seu caso, "www-data"

/var/lib/nginx/tmp/fastcgi/2/00/0000000002" failed (13: Permission denied)

tente "chown -cR www-data. / var / lib / nginx"

    
por 02.06.2014 / 08:17