404 on nginx 1.0.2 and Mono

This article was originally published in my blog (affectionately referred to as blargh) on . The original blog no longer exists as I've migrated everything to this wiki.

The original URL of this post was at https://tmont.com/blargh/2011/5/404-on-nginx-1-0-2-and-mono. Hopefully that link redirects back to this page.

If you're using Mono via FastCGI with nginx, and you just upgraded to nginx 1.0, you may be experiencing a 404 on the default page. Or at least I was, on both of my apps that use ASP.NET MVC (one uses 2 and one uses 3, I'm a glutton for punishment).

Specifically, the error was about not being able to find a controller for the name "/Default.aspx/Default.aspx".

Anyway, the fix is to remove all traces of index and fastcgi_index from your conf:

nginx
server {
  listen 80;
  server_name example.com;

  location / {
    root /var/www/example.com;
    index Default.aspx;
    fastcgi_index Default.aspx;
    fastcgi_pass 127.0.0.1:9000;
    include /etc/nginx/fastcgi_params;
  }
}
becomes
nginx
server {
  listen 80;
  server_name example.com;

  location / {
    root /var/www/example.com;
    fastcgi_pass 127.0.0.1:9000;
    include /etc/nginx/fastcgi_params;
  }
}

I may have just had it misconfigured, but maybe it'll help somebody else.