Double try_files to solve the nginx's "No input file specified" issue
Posted
by
Howard
on Server Fault
See other posts from Server Fault
or by Howard
Published on 2012-11-04T11:18:47Z
Indexed on
2012/11/05
17:05 UTC
Read the original article
Hit count: 238
I am following the nginx's wiki (http://wiki.nginx.org/WordPress) to setup my wordpress
location / {
try_files $uri $uri/ /index.php?$args;
}
By using the above lines, when a static file which is not found it will redirect to index.php
of wordpress, that is okay but..
Problem: When I request an non-existence php script, e.g. http://www.example.com/foo.php, nginx will give me
No input file specified
I want nginx to return 404 instead of the above message, so in the main fcgi config, I add the 2nd try_files
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
...
}
And this worked, but I am looking if there are any better way to handle it?
© Server Fault or respective owner