Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a configuration like this:

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;
        }
}

where, the content of file php_fastcgi.conf is this:

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;

If I try to invoke a page like mydomain.org/index.php all gone well, but, when I try to open a page into users location (mydomain/~user/index.php) I've got this error: "No input file specified.". There is a way to solve this problem ?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I have found the solution. This new conf file works.

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;
        }
}
share|improve this answer

Try updating the following section of you nginx.conf file from this:

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

...to this:

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;
}

Also, make sure that you restart nginx after you make the change.

share|improve this answer
    
it returns the same error –  Sebastiano Merlino Aug 28 '11 at 19:29
    
Did you completely replace your location ~ \.php$ block with the one I provided? Double-check that there is an asterisk (*) at the end of the root declaration. –  Mike Moore Aug 28 '11 at 19:32
    
I have removed the section from my file and have done copy-paste from what you have posted. –  Sebastiano Merlino Aug 28 '11 at 19:45
    
solution found. Thanks for all the help –  Sebastiano Merlino Aug 28 '11 at 19:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.