Welcome! Log In Create A New Profile

Advanced

Re: Problem with try files: =404 results in php files being downloaded instead of parsed by php

Maxim Dounin
June 25, 2012 06:22AM
Hello!

On Sun, Jun 24, 2012 at 06:24:01PM -0400, Xaymar wrote:

> Hello,
>
> I tried changing my template configuration so that it would show "404
> not found" instead of "No input file specified." but to my surprise,
> try_files did something completely unpredictable and now I'm stuck with
> "No input file specified.". To be exact I tried changin this:
> > try_files "$uri" "$uri/" "/index.php";
> into this:
> > try_files "$uri" "$uri/" "/index.php" =404;
> which then resulted in nginx sending the php file as
> application-octet-stream, instead of parsing it through the fastcgi
> handler.

You've asked nginx to return /index.php as static if $uri isn't
found, and it does so. No surprise here.

> How do I do the above right, if not with the try_files syntax?

Add "try_files $uri =404;" to your "location ~ \.php" instead.

[...]

Maxim Dounin

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

Re: Problem with try files: =404 results in php files being downloaded instead of parsed by php

Maxim Dounin June 25, 2012 06:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 160
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready