Requests ending with / (slash) are returning 404

Igor Sysoev igor at sysoev.ru
Wed Apr 7 13:47:14 MSD 2010


On Wed, Apr 07, 2010 at 07:30:22PM +1000, Leonardo Crespo wrote:

> Just curious,
> 
> Why the {} in ${uri}index.php and not in $uri.php?
> 
> I'm assuming it's to identify uri as a keyword, but wouldn't it be
> necessary on the $uri.php as well?

You may use ${uri}.php, but "." means already the end of keyword.

> On Wed, Apr 7, 2010 at 7:26 PM, Leonardo Crespo <leo at leocrespo.com> wrote:
> > I can't make sense of those 2.
> >
> >>  try_files $uri.php ${uri}index.php =404;
> >
> > This means: if  the uri is xxx, try to serve xxx.php. If you can't,
> > try serving xxxindex.php. If you can't still, return 404.
> >
> >>  try_files $uri.php $uri/ =404;
> >
> > This means: if the uri is xxx, try to serve xxx.php.  If you can't,
> > try serving xxx/ . If you can't still, return 404.
> >
> > Correct? They both work fine, what is the difference between them?
> >
> > On Wed, Apr 7, 2010 at 7:16 PM, Edho P Arief <edhoprima at gmail.com> wrote:
> >> On Wed, Apr 7, 2010 at 4:10 PM, Leonardo Crespo <leo at leocrespo.com> wrote:
> >>> Hi Edho, thanks.
> >>>
> >>> Igor mentioned i should keep this to avoid serving php as static files.
> >>>
> >>> location ~ \.php$
> >>>        {
> >>>                fastcgi_pass 127.0.0.1:9000;
> >>>                fastcgi_intercept_errors on;
> >>>                fastcgi_index index.php;
> >>>                include /usr/local/nginx/conf/fastcgi_params;
> >>>                fastcgi_param SCRIPT_FILENAME
> >>> /home/public_html/boysdownunder.com.au/public/$fastcgi_script_name;
> >>>        }
> >>>
> >>> Will it conflict with this?
> >>>
> >>>> location ~ \.php$ {
> >>>>  return 404;
> >>>> }
> >>>
> >>
> >> as all php requests (usin are passed to @php block (or / block in
> >> Igor's example), there shouldn't be any problem.
> >>
> >> And in my example it should be
> >>
> >>  try_files $uri.php ${uri}index.php =404;
> >>
> >> instead of
> >>
> >>  try_files $uri.php $uri/ =404;
> >>
> >>
> >> --
> >> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
> >>
> >> _______________________________________________
> >> nginx mailing list
> >> nginx at nginx.org
> >> http://nginx.org/mailman/listinfo/nginx
> >>
> >
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx

-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list