Yet another "No input file specified." thread

Hi folks.
I’ve been tearing what little hair I have left out trying to find the
problem with this.
nginx version 0.7.61 installed from Jeff W.s site. On Ubuntu 9.4
Jackalope.

/etc/nginx/nginx.conf - standard, as issued. #
/etc/nginx/sites-enabled/default contains
server {
listen 80;
server_name localhost ;
access_log /var/log/nginx/localhost.access.log;
location / {
root /var/www/nginx-default;
index index.html index.htm;
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}

/etc/nginx/fastcgi_params contains
fastcgi_param GATEWAY_INTERFACE CGI/1.1;

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

Symptoms
http://localhost/missing.htm - error 404 correct
http://localhost - serves index.htm correct
http://localhost/present.htm - served correctly
http://localhost/present.php - can give two errors
if fastcgi gateway is running I get “No input file spcified.”
if the fastcgi gateway is not up, I get Bad Gateway,
So I know the gateway is running, I telnet’ed into it - and it kicked me
out.

if I run the present.php file on the command line it runs as expected.

I’m sure it is something so very simple that I’m kick myself - I just
can’t see what.

Any help with this much appreciated.

Ian

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,9100,9100#msg-9100

either add another
root /var/www/nginx-default; to your location ~ .php$ block or move
the root directive into the server block instead of location /

On Fri, Sep 25, 2009 at 00:21, Rob S. [email protected] wrote:
[…]

    location ~ .php$ {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index  index.php;
        include /etc/nginx/fastcgi_params;
    }

Try using something like:

location ~ .(php|html)$ {
fastcgi_pass localhost:yourPort;
include fastcgi_params;

add aditional parameters only after the include, so they’ll override

fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME 

/path/to/your/docroot$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /path/to/your/docroot;
fastcgi_intercept_errors on; # for easier debug
}

Mainly, the document_root param should be afer the include, otherwise
you’re using your server’s doc_root instead of your site’s doc_root. I
think…

HTH

On Fri, Sep 25, 2009 at 01:26:43AM +0100, Nuno Magalh??es wrote:

Mainly, the document_root param should be afer the include, otherwise
you’re using your server’s doc_root instead of your site’s doc_root. I
think…

No, it’s enough to add “root” in

location ~ \.php$ {
    root /path/to/your/docroot;
    ...

Thanks for your input guys. All is working fine now.

What is odd is that I am sure I simply removed comments from the
standard (0.6.whatever Ubuntu) file,
and that is what had root and index inside location /

Oh well. Thanks again

Ian

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,9100,9176#msg-9176

On Fri, Sep 25, 2009 at 6:21 AM, Rob S. [email protected]
wrote:

either add another
root /var/www/nginx-default; to your location ~ .php$ block or move the
root directive into the server block instead of location /

someone should save this answer as template.

Anyone have any ideas about this one?
Thanks
Mike

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,9100,145718#msg-145718

I’m on Windows XP. Not sure if that makes a diff or not. I can’t
figure out how to get my document root outside of the nginx folder.


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   ../webs;
            index  index.html index.htm index.php;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        #pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000

        location ~ \.php$ {
            root           ../webs;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME
c:/nginx/html/$fastcgi_script_name;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based
configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

Any help would be greatly appreciated.
Thanks
Mike

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,9100,142403#msg-142403

Hi dmikester1

I’m reposting the reply - it appear the O/P didn’t see it and neither
did I.

You put a root stanza in the config file - typically inside the server
{} brackets - but see
http://wiki.nginx.org/NginxHttpCoreModule#root

On windows, I believe you need to convert the file names from - for
example - d:\websites\asite
into d/websites/asite if nginx runs under cygwin

Regards

Ian

Andy if nginx does not run under cygwin?
Thanks
Mike

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,9100,145840#msg-145840

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs