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 problem setting up nginx (with passenger, which works fine) with php-fpm on Fedora. When I try access index.php via browser, I get "No input file specified."

Nginx error log:

2013/11/29 12:50:47 [error] 2218#0: *15 FastCGI sent in stderr: "Unable to open primary script: /home/nginx/html/phptest/index.php (No such file or directory)" while reading response header from upstream, client: 109.230.17.250, server: ..., request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "..." That file exists.

PHP-FPM error log shows nothing.

PHP-FPM status page works. Nginx and PHP-FPM are running under user nginx.

Nginx conf:

        server {
            listen 80;
            server_name ...;
            root /home/nginx/html/phptest;
            index index.php index.html index.htm;
            location ~ \.php$ {
                    include fastcgi.conf;
                    try_files $uri =404;
                    fastcgi_pass 127.0.0.1:9000;
            }
            location ~ ^/(status|ping)$ {
                 #access_log off;
                 include fastcgi.conf;
                 fastcgi_pass 127.0.0.1:9000;
            }
    }

PHP: doc_root is empty, open_basedir is not defined, cgi.fix_pathinfo=0 https://gist.github.com/anonymous/7705152

PHP-FPM www.conf: https://gist.github.com/anonymous/7705155

index.php file exists and is accesible from user nginx itself and from different user.

I have tried different nginx configuration and nothing helped. I guess it has something with different path handling around fastcgi, but I have no idea what to do with it.

Thanks for help.

UPDATE: SELinux was causing this problem, now I am running it in permissive mode. Not sure how to create proper policy without causing outage.

share|improve this question
    
Can you post /etc/php5/fpm/pool.d/www.conf and /etc/php.ini please –  sgtbeano Nov 29 '13 at 12:15
    
Updated question with links. –  Ondrej Galbavý Nov 29 '13 at 12:40
    
Check to see that the file /home/nginx/html/phptest/index.php exists and is readable. –  Michael Hampton Nov 29 '13 at 19:11
    
Yes it is. I have just disabled selinux enforcement and php file executes. I have forgot about it, because self compiled nginx (gem passenger) did not have problem with that. I have tried installing Apache and I have found following in error log: [Fri Nov 29 20:16:34.112015 2013] [suexec:notice] [pid 5447] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) AH00112: Warning: DocumentRoot [/home/nginx/html/phptest] does not exist –  Ondrej Galbavý Nov 29 '13 at 19:34
add comment

1 Answer

Can you try changing your server block to this;

server {
    listen 80;
    server_name ...;
    root /home/nginx/html/phptest;
    index index.php index.html index.htm;
    location ~ \.php$ {
        root           /home/nginx/html/phptest;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}
share|improve this answer
    
Did not help, same result. Same error in nginx log. –  Ondrej Galbavý Nov 29 '13 at 18:14
    
Can you try using a socket rather than 127.0.0.1:9000 - you can change this in the www.conf and also then change the fastcgi_pass to path of your socket too. –  sgtbeano Dec 2 '13 at 10:05
add comment

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.