# Yet another "No input file specified." thread

**URL:** <https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126>\
**Category:** NGINX\
**Created:** [September 25, 2009, 1:04am UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126 "2009-09-25T01:04:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hobson42](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@hobson42](https://www.ruby-forum.com/u/hobson42)\
**Post date:** [September 25, 2009, 1:04am UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126/1 "2009-09-25T01:04:30Z")

</div>

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](http://localhost/missing.htm) - error 404 correct  
[http://localhost](http://localhost) - serves index.htm correct  
[http://localhost/present.htm](http://localhost/present.htm) - served correctly  
[http://localhost/present.php](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:

> **[Yet another "No input file specified." thread](https://forum.nginx.org/read.php?2,9100,9100#msg-9100)**
>
> 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 Waughs site. On Ubuntu 9.4 Jackalope. /etc/nginx/nginx.conf - standard, as issued. #...

---

<div class="post-metadata">

**Author:** ![hobson42](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@hobson42](https://www.ruby-forum.com/u/hobson42)\
**Post date:** [September 25, 2009, 1:31am UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126/2 "2009-09-25T01:31:27Z")

</div>

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 /

---

<div class="post-metadata">

**Author:** ![hobson42](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@hobson42](https://www.ruby-forum.com/u/hobson42)\
**Post date:** [September 25, 2009, 2:39am UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126/3 "2009-09-25T02:39:21Z")

</div>

On Fri, Sep 25, 2009 at 00:21, Rob S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![hobson42](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@hobson42](https://www.ruby-forum.com/u/hobson42)\
**Post date:** [September 25, 2009, 9:56am UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126/4 "2009-09-25T09:56:03Z")

</div>

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

```

---

<div class="post-metadata">

**Author:** ![hobson42](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@hobson42](https://www.ruby-forum.com/u/hobson42)\
**Post date:** [September 25, 2009, 12:26pm UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126/5 "2009-09-25T12:26:31Z")

</div>

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:

> **[Re: Yet another "No input file specified." thread](https://forum.nginx.org/read.php?2,9100,9176#msg-9176)**
>
> 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 Waughs site. On Ubuntu 9.4 Jackalope. /etc/nginx/nginx.conf - standard, as issued. #...

---

<div class="post-metadata">

**Author:** ![hobson42](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@hobson42](https://www.ruby-forum.com/u/hobson42)\
**Post date:** [September 25, 2009, 1:19pm UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126/6 "2009-09-25T13:19:11Z")

</div>

On Fri, Sep 25, 2009 at 6:21 AM, Rob S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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.

---

<div class="post-metadata">

**Author:** ![hobson42](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@hobson42](https://www.ruby-forum.com/u/hobson42)\
**Post date:** [October 29, 2010, 4:54pm UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126/7 "2010-10-29T16:54:45Z")

</div>

Anyone have any ideas about this one?  
Thanks  
Mike

Posted at Nginx Forum:

> **[Re: Yet another "No input file specified." thread](https://forum.nginx.org/read.php?2,9100,145718#msg-145718)**
>
> 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 Waughs site. On Ubuntu 9.4 Jackalope. /etc/nginx/nginx.conf - standard, as issued. #...

---

<div class="post-metadata">

**Author:** ![hobson42](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@hobson42](https://www.ruby-forum.com/u/hobson42)\
**Post date:** [October 19, 2010, 7:55pm UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126/8 "2010-10-19T19:55:38Z")

</div>

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.

```auto

#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:

> **[Re: Yet another "No input file specified." thread](https://forum.nginx.org/read.php?2,9100,142403#msg-142403)**
>
> 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 Waughs site. On Ubuntu 9.4 Jackalope. /etc/nginx/nginx.conf - standard, as issued. #...

---

<div class="post-metadata">

**Author:** ![hobson42](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@hobson42](https://www.ruby-forum.com/u/hobson42)\
**Post date:** [October 29, 2010, 8:41pm UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126/9 "2010-10-29T20:41:47Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![hobson42](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/ea5d25/32.png) [@hobson42](https://www.ruby-forum.com/u/hobson42)\
**Post date:** [October 29, 2010, 11:05pm UTC](https://www.ruby-forum.com/t/yet-another-no-input-file-specified-thread/176126/10 "2010-10-29T23:05:17Z")

</div>

Andy if nginx does not run under cygwin?  
Thanks  
Mike

Posted at Nginx Forum:

> **[Re: Yet another "No input file specified." thread](https://forum.nginx.org/read.php?2,9100,145840#msg-145840)**
>
> 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 Waughs site. On Ubuntu 9.4 Jackalope. /etc/nginx/nginx.conf - standard, as issued. #...
