nginx - php fastgi - usuários dir

1

Eu tenho uma configuração assim:

worker_processes  2;  
error_log  logs/error.log;
pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    server_names_hash_bucket_size 64; 

    access_log  logs/access.log;

    sendfile        on; 
    tcp_nopush     on; 
    tcp_nodelay    on; 

    keepalive_timeout  75 20; 

    gzip  on; 
    gzip_comp_level 1;

    gzip_proxied any;
    gzip_min_length 1100;
    gzip_buffers 4 8k;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml    application/xml+rss text/javascript;

    server {
        listen       80;
        server_name  localhost;
        access_log  logs/host.access.log;

        location / {
            root   /var/www;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /var/www;
        }
        location ~* ^.+\.(jpg|jpeg|gif)$ {
            root         /var/www;
            access_log   off;
            expires      30d;
        }

        location ~ /\.ht {
            deny  all;
        }

        location ~ ^/~(.+?)(/.*)?$ {
            alias /home/$1/public_html$2;
            index  index.html index.htm;
            autoindex on;
            location ~ \.php$ {
                    root /home/$1/public_html;
                    include php_fastcgi.conf;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            }
        }
        location ~ \.php$ {
            root           /var/www;
            include php_fastcgi.conf;
            fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
        }
}

onde, o conteúdo do arquivo php_fastcgi.conf é este:

fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
include        fastcgi_params;
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;
fastcgi_intercept_errors on;

Se eu tentar invocar uma página como mydomain.org/index.php tudo correu bem, mas, quando eu tento abrir uma página na localização dos usuários (mydomain / ~ user / index.php) eu tenho esse erro : "Nenhum arquivo de entrada especificado.". Existe uma maneira de resolver este problema?

    
por Sebastiano Merlino 28.08.2011 / 20:56

2 respostas

1

Eu encontrei a solução. Este novo arquivo conf funciona.

worker_processes  2;  
error_log  logs/error.log;
pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    server_names_hash_bucket_size 64; 

    access_log  logs/access.log;

    sendfile        on; 
    tcp_nopush     on; 
    tcp_nodelay    on; 

    keepalive_timeout  75 20; 

    gzip  on; 
    gzip_comp_level 1;

    gzip_proxied any;
    gzip_min_length 1100;
    gzip_buffers 4 8k;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml    application/xml+rss text/javascript;

    server {
        listen       80;
        server_name  localhost;
        access_log  logs/host.access.log;

        location / {
            root   /var/www;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /var/www;
        }
        location ~* ^.+\.(jpg|jpeg|gif)$ {
            root         /var/www;
            access_log   off;
            expires      30d;
        }

        location ~ /\.ht {
            deny  all;
        }
        location ~ ^/~(.+?)(/.*\.php)?$ {
                root /home/$1/public_html;
                include php_fastcgi.conf;
                fastcgi_param SCRIPT_FILENAME /home/$1/public_html$2;
        }
        location ~ ^/~(.+?)(/.*)?$ {
            alias /home/$1/public_html$2;
            index  index.html index.htm;
            autoindex on;
        }
        location ~ \.php$ {
            root           /var/www;
            include php_fastcgi.conf;
            fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
        }
}
    
por 28.08.2011 / 21:52
0

Tente atualizar a seguinte seção do seu arquivo nginx.conf :

location ~ \.php$ {
    root           /var/www;
    include php_fastcgi.conf;
    fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
}

... para isso:

location ~ \.php$ {
    root           /var/www*;
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_index   index.php;
    fastcgi_param   SCRIPT_FILENAME /var/www/$fastcgi_script_name;
    include         fastcgi_params;
}

Além disso, certifique-se de reiniciar o nginx depois de fazer a alteração.

    
por 28.08.2011 / 21:19

Tags