0

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.

1 Answers1

0

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;
    }
}
sgtbeano
  • 350