Forum: NGINX Error "No input file specified" (wrong fastcgi_param?)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6bba3d67d2435084b04407dd263b4090?d=identicon&s=25 Stefan Scott (stefanscott)
on 2008-12-01 03:33
Hello Everyone -

I've installed nginx-0.6.33 + php-5.2.6 + php-fpm-0.5.9 + xcache-1.2.2
under Debian 4.0 (Etch) on a VPS (virtual private server), using the
instructions here:

http://wiki.codemongers.com/NginxFullExample
http://www.yawn.it/2008/04/30/nginx-php-php-fpm-on...
http://firedemon.su/?p=200   ( к счастью учил русский 
язык давно в
колледже :-)
http://www.darvilworld.com/?cat=5

--------------------------------------------------------

Now my browser can display index.html with no problem:

$  cat /usr/local/nginx/html/myvhost1.com/index.html
## ... Welcome to myvhost1.com ...


But when I try to display index.php...

$  cat /usr/local/nginx/html/myvhost1.com/index.php
<? phpinfo(); ?>

...my browser displays the following error:

No input file specified.

--------------------------------------------------------

As a further test, I deliberately entered some bad pages:

http://myvhost1.com/bad-page.html

404 Not Found
nginx/0.6.33

http://myvhost1.com/bad-page.php

No input file specified.

--------------------------------------------------------

Here's my nginx.conf file:

$  cat /usr/local/nginx/conf/nginx.conf

user  www-data www-data;
worker_processes  2;

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

    gzip on;
    gzip_comp_level 1; gzip_proxied any;
    gzip_types text/plain
               text/html
               text/css
               application/x-javascript
               text/xml
               application/xml
               application/xml+rss
               text/javascript;

    server {
        listen       80;
        server_name  .myvhost1.com;

        location / {
            root   html/myvhost1.com;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {
            root   html;
        }

        location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include /usr/local/nginx/conf/fastcgi_params;
        }
    }

}

--------------------------------------------------------

And here's my fastcgi_params file (I added the line at the end):

$  cat /usr/local/nginx/conf/fastcgi_params

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_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  GATEWAY_INTERFACE  CGI/1.1;
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;

# I ADDED THIS LINE
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

--------------------------------------------------------

I'm new to all this so I don't know what I'm doing wrong here.

I'd appreciate any ideas you might have.

Thanks.

- Stefan Scott
6bba3d67d2435084b04407dd263b4090?d=identicon&s=25 Stefan Scott (stefanscott)
on 2008-12-01 03:49
PS - Here is the directory listing showing that file 'index.php' does
exist (and page 'bad-page.php' does not exist) - along with the
permissions, in case that's any help:

$  ls -l /usr/local/nginx/html/myvhost1.com
total 12
-rw-r--r-- 1 root staff 383 2008-11-27 15:13 50x.html
-rw-r--r-- 1 root staff 146 2008-11-27 15:17 index.html
-rw-r--r-- 1 root staff  17 2008-12-01 01:30 index.php

The file /usr/local/nginx/html/myvhost1.com/index.php does exist and the
file  /usr/local/nginx/html/myvhost1.com/index.php does not exist - but
in both cases the browser gives the message "No input file specified."

I'm sure this is a simple error I'm making involving one of the
fastcgi_param values, but I don't know how to fix it!
6bba3d67d2435084b04407dd263b4090?d=identicon&s=25 Stefan Scott (stefanscott)
on 2008-12-01 03:59
Also, in case this helps, here is a portion of my
/usr/local/etc/php-fpm.conf file:

## /usr/local/etc/php-fpm.conf
## THE BELOW HAVE BEEN UPDATED AS SHOWN, FOLLOWING THE INSTRUCTIONS AT:
## http://www.yawn.it/2008/04/30/nginx-php-php-fpm-on...
## http://firedemon.su/?p=200   ( ? ??????? ???? ??????? ???? ????? ?


## LINES 40-42
   Address to accept fastcgi requests on.
   Valid syntax is 'ip.ad.re.ss:port' or just 'port' or
'/path/to/unix/socket'
   <value name="listen_address">127.0.0.1:9000</value>

## LINES 63-67
   Unix user of processes
   <value name="user">www-data</value>

   Unix group of processes
   <value name="group">www-data</value>
C996e830c7dc59a5e8db36dff386325f?d=identicon&s=25 Rob Schultz (schultz)
on 2008-12-01 04:44
(Received via mailing list)
You need to either put

root   html/myvhost1.com;

inside your php location block or define it in the server block and
don't worry about putting it in your location /  block. Personally i
would get ride of the location / block and define root and index
server wide. so in cases if you have
location /somedir {
}

you won't have to redefine root and index there also.

Rob
88098c5295e0de78509b0febd92eb646?d=identicon&s=25 Marlon de Boer (Guest)
on 2008-12-01 13:22
(Received via mailing list)
Hi,

I want to filter out the following requests

nginx: 127.0.0.1 - - [01/Dec/2008:13:10:15 +0100] "-" 400 0

I want to filter it out with a location match

location = - {
  access_log off;
  return 444;
}

This doesn't work, any other method to match a "-" request?

Regards
Marlon
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-12-01 13:49
(Received via mailing list)
On Mon, Dec 01, 2008 at 01:15:28PM +0100, Marlon de Boer wrote:

>
> This doesn't work, any other method to match a "-" request?

No, this does not work as "-" in access_log means no request line at
all.
7ce625ba598c1198061bdf1b1a1353a5?d=identicon&s=25 曹 海峰 (Guest)
on 2008-12-01 14:08
(Received via mailing list)
hiya :
 Now I use the Nginx 7.x +tomcat 6.x
 I have some application should use post method to request  tge static
page
 but always filed  i use the httpwatch to catch the package ,I find the
url give the 405 code
what should I do?
thanks
Ed6583386f2b2d56e1b5eb2ee236da39?d=identicon&s=25 Nick Pearson (Guest)
on 2008-12-01 15:30
(Received via mailing list)
If I understand correctly, I had the same problem and solved it using
this:
server {
  ...
  location / {
    if ($request_method = POST) {
      proxy_pass http://upstream_server;
      break;
    }
    ...
  }
}

This is the first "if" statement in in my "location" directive.  If the
request is a post, it is automatically sent to the app server and cached
files are ignored even if they exist.

Hope that helps.

Nick


2008/12/1 曹 海峰 <dennis__cao@hotmail.com>
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-12-01 15:34
(Received via mailing list)
On Mon, Dec 01, 2008 at 08:58:42PM +0800, ?? ???p wrote:

> hiya :
>  Now I use the Nginx 7.x +tomcat 6.x
>  I have some application should use post method to request  tge static page
>  but always filed  i use the httpwatch to catch the package ,I find the url give the 405 
code
> what should I do?
> thanks

What should static page do with a POST request ?
7ce625ba598c1198061bdf1b1a1353a5?d=identicon&s=25 dennis cao (Guest)
on 2008-12-01 15:41
(Received via mailing list)
thanks !
I will try it tomorrow



Date: Mon, 1 Dec 2008 08:20:47 -0600From: nick.pearson@gmail.comTo:
nginx@sysoev.ruSubject: Re: about use post method to request the static
pageIf I understand correctly, I had the same problem and solved it
using this:

server {
  ...
  location / {
    if ($request_method = POST) {
      proxy_pass http://upstream_server;
      break;
    }
    ...
  }
}

This is the first "if" statement in in my "location" directive.  If the
request is a post, it is automatically sent to the app server and cached
files are ignored even if they exist.

Hope that helps.

Nick

2008/12/1 曹 海峰 <dennis__cao@hotmail.com>

hiya : Now I use the Nginx 7.x +tomcat 6.x I have some application
should use post method to request  tge static page  but always filed  i
use the httpwatch to catch the package ,I find the url give the 405
codewhat should I do?thanks

下載 Windows Live Messenger 8.5 
最新版,多元溝通、盡情分享,和即時傳訊好友線上同樂!— 
立即下載
Ed6583386f2b2d56e1b5eb2ee236da39?d=identicon&s=25 Nick Pearson (Guest)
on 2008-12-01 15:44
(Received via mailing list)
For me I wanted this so that forms on my sites could be posted to the
same
URL that was used to request the page.  Specifically, I didn't want the
user
to be taken to a different URL when there were form post errors, and I
didn't want the server to issue a redirect back to the original URL to
show
an error message to the user.
For example, if the user is at mysite.com/contact and submits a form
without
filling out a required field, I wanted the user to remain at that
location
while viewing the error message and without a redirect.  The only way I
knew
to do this was to set the form's action attribute to the "static" page's
location (the current URL) and have nginx do a pass-through for form
posts.

I should mention that my requirements might be different from what
Dennis
Cao (?) is trying to do.  I've written a content management system that
caches pages at the request path when it receives "get" requests, so
although my contact page is "static", it may or may not exist before the
request is made.  As such, even for this static page, the "get" request
may
be passed through to the CMS anyway.

And because I wanted my application to have complete control over how
"post"
requests are handled, I configured nginx to pass all post requests
through
to the application regardless of the URL that was posted to.
Fda08117336cfde6562315df04b976e8?d=identicon&s=25 Dave Cheney (Guest)
on 2008-12-01 15:58
(Received via mailing list)
You may have a local process that is polling nginx to see if port 80
is open then droping the connection.

One solution is to setup a default host seperate from your main vhosts
and then disable access logging for that host.

Cheers dave
7ce625ba598c1198061bdf1b1a1353a5?d=identicon&s=25 dennis cao (Guest)
on 2008-12-01 16:35
(Received via mailing list)
I am sorry ,i do not know  why the the developer use this method
But this is must to be used> Date: Mon, 1 Dec 2008 17:24:06 +0300> From:
is@rambler-co.ru> To: nginx@sysoev.ru> Subject: Re: about use post
method to request the static page> > On Mon, Dec 01, 2008 at 08:58:42PM
+0800, ?? ???p wrote:> > > hiya :> > Now I use the Nginx 7.x +tomcat
6.x> > I have some application should use post method to request tge
static page > > but always filed i use the httpwatch to catch the
package ,I find the url give the 405 code> > what should I do?> >
thanks> > What should static page do with a POST request ?> > > -- >
Igor Sysoev> http://sysoev.ru/en/>
6bba3d67d2435084b04407dd263b4090?d=identicon&s=25 Stefan Scott (stefanscott)
on 2008-12-01 20:40
Hello -

A solution has been provided on another forum, by
Andrei Nigmatulin (the creator of PHP-FPM):

http://groups.google.com/group/highload-php-en/bro...


I believe the solution provided above by Rob Schultz is equivalent.

Thanks! I'm starting to get the hang of how the nginx.conf file works
now.

- Stefan Scott
7ce625ba598c1198061bdf1b1a1353a5?d=identicon&s=25 dennis cao (Guest)
on 2008-12-02 07:10
(Received via mailing list)
the java program is working well with apache  !but i would like to use
the nginx



From: dennis__cao@hotmail.comTo: nginx@sysoev.ruSubject: RE: about use
post method to request the static pageDate: Mon, 1 Dec 2008 23:25:26
+0800

I am sorry ,i do not know  why the the developer use this methodBut this
is must to be used> Date: Mon, 1 Dec 2008 17:24:06 +0300> From:
is@rambler-co.ru> To: nginx@sysoev.ru> Subject: Re: about use post
method to request the static page> > On Mon, Dec 01, 2008 at 08:58:42PM
+0800, ?? ???p wrote:> > > hiya :> > Now I use the Nginx 7.x +tomcat
6.x> > I have some application should use post method to request tge
static page > > but always filed i use the httpwatch to catch the
package ,I find the url give the 405 code> > what should I do?> >
thanks> > What should static page do with a POST request ?> > > -- >
Igor Sysoev> http://sysoev.ru/en/>



聰明搜尋和瀏覽網路的免費工具列 — Windows Live 搜尋工具列
This topic is locked and can not be replied to.