404 on nginx 1.0.2 and Mono[source]
xml
<glacius:metadata> | |
<title>404 on nginx 1.0.2 and Mono</title> | |
<description>Mono/nginx 404 errors</description> | |
<category>Legacy blog posts</category> | |
<category>Programming</category> | |
<category>C#</category> | |
<category>nginx</category> | |
<category>Web servers</category> | |
</glacius:metadata> | |
<glacius:macro name="legacy blargh banner"> | |
<properties> | |
<originalUrl>https://tmont.com/blargh/2011/5/404-on-nginx-1-0-2-and-mono</originalUrl> | |
<originalDate>2011-05-13T04:46:54.000Z</originalDate> | |
</properties> | |
</glacius:macro> | |
<p> | |
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). | |
</p> | |
<p> | |
Specifically, the error was about not being able to find a controller for the | |
name "/Default.aspx/Default.aspx". | |
</p> | |
<p> | |
Anyway, the fix is to remove all traces of <code>index</code> and <code>fastcgi_index</code> | |
from your conf: | |
</p> | |
<glacius:code lang="nginx"><![CDATA[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; | |
} | |
}]]></glacius:code> | |
becomes | |
<glacius:code lang="nginx"><![CDATA[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; | |
} | |
}]]></glacius:code> | |
<p> | |
I may have just had it misconfigured, but maybe it'll help somebody else. | |
</p> | |