Welcome! Log In Create A New Profile

Advanced

Re: NGINX and Slim PHP framework

Edho Arief
October 22, 2016 06:44AM
Hi,

On Sat, Oct 22, 2016, at 19:37, Ben wrote:
> Hi,
>
> nginx/1.10.0 & PHP 7.0.8
>
> I'm struggling to get NGINX to work with the Slim PHP framework for
> paths.
>
> The base index.php works fine (e.g. http://example.com works), however
> if I try a framework path (e.g. http://example.com/hello/test), NGINX
> sends me what Firefox seems to call a "DMS file" (if I download and open
> it, it displays the source code from the PHP file).
>
> My NGINX config looks as follows:
>
> server {
> listen 80 default_server;
> listen [::]:80 default_server;
> root /var/www/html/bobs/public;
> index index.php;
> server_name _;
> location / {
> try_files $uri $uri/ /index.php$is_args$args =404;

try_files immediately returns the file without doing another location
lookup so here it'll just return the index.php as is. index.php should
be the last one. It doesn't make sense to have =404 anyway since
index.php part will always succeed.

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

NGINX and Slim PHP framework

Ben October 22, 2016 06:38AM

Re: NGINX and Slim PHP framework

Edho Arief October 22, 2016 06:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 151
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