Welcome! Log In Create A New Profile

Advanced

Re: No Input File Specified

March 04, 2012 09:36PM
On Sun, 2012-03-04 at 20:11 -0500, Sageth wrote:
> Hi, I'm fairly new to Nginx (an Apache convert) and have run into an
> issue where my site works, but one particular POST function fails with
> "No Input File Specified." The POST is a port of an old IPBv2 script to
> submit scores into a database via the URL:
> http://www.example.com/game/123/index.php?act=Arcade&do=newscore
>
> I have verified permissions
>
> In Apache, the RewriteRule was:
> RewriteRule ^game/(.*)/(.*)\.php$ index.php?act=Arcade&do=newscore [L]
>
> In nginx, I have:
> rewrite ^/game/(.*)/(.*)\.php$ /index.php?act=Arcade&do=newscore last;
>
> Here's my site's .conf (some info masked). Can anyone help point me in
> a direction? I'm not sure what I'm missing and I've spent a solid 12
> hours on it, so would greatly appreciate any help.
>
> server {
> listen 80;
> server_name www.example.com;
> root /var/www/example;
> location / {
> try_files $uri $uri/ @gss;
> }
> location ~ \.php$ {
> try_files $uri /index.php?$args =404;
> if ($uri !~ "^/uploads/") {
> fastcgi_pass unix:/var/run/php-fcgi.pid;
> }
> location ~ /arcade/gamedata/(.*)$ {
> alias /var/www/example/arcade/gamedata/$1;
> internal;
> break;
> }
> location @gss {
> #Rewrite the games
> rewrite ^/game/(.*)/(.*)\.php$ /index.php?act=Arcade&do=newscore
> last;
> rewrite ^/play/index.php$ /index.php?act=Arcade&do=newscore last;
> rewrite ^/game/(.*)/arcade/(.*)$ /arcade/$2 last;
> rewrite ^/play/arcade/(.*)$ /arcade/$1 last;
> rewrite ^/(.*).html$ /index.php?params=$1 last;
> }
> }

I believe that what is happening is the \.php$ location is matched
first, so your rewrite rules are never called for PHP scripts. See here
for the order Nginx processes locations:

http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration

Specifically, the sentence "The first matching expression stops the
search and nginx will use this location." The / location is used as a
fallback in case no specific regex location is matched.

Instead, something like this might work (untested):

location ~ \.php$ {
rewrite ^/game/(.*)/(.*)\.php$ /index.php?act=Arcade&do=newscore break;
rewrite ^/play/index.php$ /index.php?act=Arcade&do=newscore break;
rewrite ^/(.*).html$ /index.php?params=$1 break;
fastcgi_pass unix:/var/run/php-fcgi.pid;
}

location @gss {
rewrite ^/game/(.*)/arcade/(.*)$ /arcade/$2 last;
rewrite ^/play/arcade/(.*)$ /arcade/$1 last;
}

Regards,
Cliff


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

No Input File Specified

Sageth March 04, 2012 08:11PM

Re: No Input File Specified

Edho Arief March 04, 2012 09:20PM

Re: No Input File Specified

Cliff Wells March 04, 2012 09:36PM

Re: No Input File Specified

Sageth March 04, 2012 10:29PM

Re: No Input File Specified

Sageth March 04, 2012 11:06PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 88
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready