S
S
Sergey2016-04-09 21:19:33
PHP
Sergey, 2016-04-09 21:19:33

How to remove empty pages when requesting Nginx to index.php?

I noticed strange behavior in Nginx when going to any links with the addition of index.php at the end.
Even if, for example, the folder does not exist (www.site.ru/ggg/index.php), then an empty page is displayed instead of 404.
I suspect that this is somehow related to this part of the config:

location / {
                # try_files $uri $uri/ ;
                limit_req zone=php2zone burst=5 nodelay;
                try_files $uri $uri/ /index.php?q=$uri&$args;
    }

 location ~ \.php$ {
                limit_req zone=php2zone burst=5 nodelay;
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include fastcgi_params;
    }

Itself in Nginix recently and I can not yet figure out what this behavior is connected with. I would be very grateful for a hint or solution!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alegzz, 2016-04-10
@alegzz

try_files $uri $uri/ /index.php?q=$uri&$args;
well, everything is correct.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question