nginx php fastcgi incapable d'écrire , de refus d'autorisation, même à l'aide de sa propre autorisation

Hi " j'ai la permission refusée lors de l'utilisation d'écriture de texte fonctionnent comme des file_put_contents. je suis l'aide de nginx à l'intérieur de centos 6 de l'environnement, j'utilise php-fcgi

le problème résolu par le jeu de la dir permission 777, mais je ne veux pas que la solution.

voici le code php

<?php
    error_reporting(E_ALL);
    header("content-type:text/plain");
    if(isset($_GET['akarapaci'])) {phpinfo();}
    echo getcwd();
    echo "\nscript owner : ".get_current_user()."\n";
    echo "\nscript getmyuid : ".getmyuid()."\n";
    echo "\nscript getmygid : ".getmygid()."\n";

    file_put_contents(dirname(__FILE__)."/X","1");
?>

voici le résultat :

/var/www/html
script owner : nginx

script getmyuid : 496

script getmygid : 493

le code est simple à écrire dans le fichier /var/www/html/X (le fichier n'est pas encore créé), et d'avoir d'erreur comme ceci

2012/10/27 19:51:59 [error] 1010#0: *32 FastCGI sent in stderr: "PHP Warning:  file_put_contents(/var/www/html/X): failed to open stream: Permission denied in /var/www/html/info.php on line 10" while reading response header from upstream, client: 111.94.49.72, server: vprzl.com, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "vprzl.com"

et voici la liste des dir dans le répertoire /var/www/

total 40
drwxr-xr-x 2 root  root   4096 Oct 27 08:44 backup
drwxr-xr-x 2 root  root   4096 Feb 14  2012 cgi-bin
drwxrwxrwx 3 root  root  12288 Oct 27 08:47 devel
drwxr-xr-x 3 root  root   4096 Oct 20 04:48 error
drwxrwxr-x 2 nginx nginx  4096 Oct 27 19:24 html
drwxr-xr-x 3 root  root   4096 Oct 17 18:19 icons
drwxr-xr-x 5 root  root   4096 Oct 27 16:57 images
drwxr-xr-x 2 root  root   4096 Oct 26 14:28 secret

et voici mon nginx.conf

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;


    server {
      listen          80;
      server_name     vprzl.com www.vprzl.com;
      index           index.html;
      root            /var/www/html/;

      location / { 
          # Rewrite rules and other criterias can go here
          # Remember to avoid using if() where possible (http://wiki.nginx.org/IfIsEvil)
          index  index.html index.htm;
      }

      location ~ \.php$ {
          include fastcgi_params;
          fastcgi_pass 127.0.0.1:9000;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      }
    }

    server {
      listen          80;
      server_name     images.vprzl.com;
      index           index.html;
      root            /var/www/images/;

      location / { 
          # Rewrite rules and other criterias can go here
          # Remember to avoid using if() where possible (http://wiki.nginx.org/IfIsEvil)
          index  index.html index.htm;
      }
    }

    server {
      listen          80;
      server_name     secret.vprzl.com;
      index           index.html;
      root            /var/www/secret/;

      location / { 
          index  index.html index.htm;
      }
    }
}
En vertu de l'utilisateur qui ne les démons fastcgi exécuter et en vertu de laquelle l'utilisateur ne le script PHP exécuté? Vous n'avez normalement pas besoin de global "rwx" quand vous connaître les besoins de l'utilisateur d'avoir l'accès en écriture.
Qu'est-ce que la sortie de ps aux | grep nginx?
c'est le résultat du ps aux | grep nginx root 1009 0.0 0.1 44624 1176 ? Ss Oct27 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf nginx 1010 0.0 0.2 45048 2140 ? S Oct27 0:00 nginx: worker process root 3588 0.0 0.0 103228 848 pts/0 S+ 02:09 0:00 grep nginx

OriginalL'auteur Shin Dapaty | 2012-10-27