alias/try_files bug?

Brian Gernhardt benji at
Thu Feb 2 21:17:53 UTC 2012

My server is running Ubuntu 11.10.  I've replicated this bug with both the nginx-light package (1.0.5) and nginx-1.0.10 (compiled via passenger).

Here's a shortened version of my site configuration: 

--- 8< ---

server {
   location /forum/ {
      alias /srv/www/forum/;
      index index.php index.html index.htm;

      location ~ \.php$ {
         # Try to stop bad PHP requests, as per wiki
         try_files $uri =404;

         fastcgi_pass php;

--- 8< ---

This configuration returns 404 for _all_ PHP requests, even for files that exist.  (There is normally a "location /" block that points to a CMS.  But removing it still has gives the same error.)

If I remove the try_files, the forum works.  If I remove the alias and use "root /srv/www" instead, it works.  Only when I use try_files and alias does it fail.

This looks like a bug to me, but I'm not familiar enough with the nginx source to track it down.

~~ Brian

More information about the nginx-devel mailing list