I have a very basic 404 error:

Description: HTTP 404.The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Details: Requested URL: /index.html

I cannot figure out which full url is finally called.

My index.html is very basic :


My config file :

server {

 listen 8045;

        server_name localhost;
        root /usr/share/nginx/asproot;

        access_log /var/log/nginx/asp.access.log;

        error_log /var/log/nginx/asp.error.log;

location / {

        index index.html index.htm default.aspx Default.aspx;

        fastcgi_index Default.aspx;


        include /etc/nginx/fastcgi_params;



The nginx user can access the root folder and read index.html (I tested this with su). In the browser I load: http://serverip:8045/index.html

So what is going wrong? How can I see what the final url is called?


I figured out that problem comes from fastcgi. I've read several articles but i'm lost !

To avoid a long question with huge historic, i abort this and i'll post a new question once i'll have understood the basics of fastcgi with nginx. Anyway i give a config that finally works (see few answers below)

  • If you want I can help you - I'm hosting .NET apps on Linux, it's a common topic for me. – Evengard Aug 18 '15 at 15:22

It seems that when you access the root directory, "index" directive gets applied, but when you are accessing directly, it applies the "fastcgi_pass" directive. You should probably check before the pass directive if the file is even present.

Seems like I have a similar need as yours, I use this config for it:

server {
    listen      80;
    server_name localhost;

    # PublicRoot
    root /usr/share/nginx/asproot;

    # Logs
    access_log /var/log/nginx/asp.access.log main buffer=50k;
    error_log /var/log/nginx/asp.error.log;

    location / {
        try_files $uri @fastcgi;

    # Fastcgi-pass
    location @fastcgi {
        fastcgi_keep_conn on;
        include /etc/nginx/fastcgi_params;
        fastcgi_intercept_errors on;


Here I first go by "try_files" directive to check if I can get the static file, but if not, I go then by the fastcgi_pass directive. But I'm hosting the aspx files in different folder, not the same with static files.

| improve this answer | |
  • you are right, i figured out that 404 happens when i write fastcgi_pass line. In a other hand fastcgi seems listening as espected (tested with (sudo netstat -lap | grep 9000) .So now we have to find a way to test fastcgi config... – Giova Aug 18 '15 at 12:50
  • Well, THAT is a totally different config, sure. Without seeing it we can't say way much. – Evengard Aug 18 '15 at 12:59

ok i finnaly made it working. I still have an other problem, index doesn't works So i have to type the full address :


if i just type :

http://localhost:8045 or http://localhost:8045/default.aspx

then i have a 404 error (so url is case sensitive)

As i said now fastcgi works, things still obscure and i have to improve it. Anyway, i give you all my config , i hope this will help someone:

OS : rapbian 3.18.11 (debian) Mono : 4.0.2 fastcgi-server4 nginx 1.2.1


config file :


commandline :


MONOSERVER=$(which fastcgi-mono-server4)

${MONOSERVER} /appconfigdir=${CONFIG_PATH} /socket=tcp: /logfile=${LOG} --verbose &



fastcgi_param   QUERY_STRING            $query_string;
fastcgi_param   REQUEST_METHOD          $request_method;
fastcgi_param   CONTENT_TYPE            $content_type;
fastcgi_param   CONTENT_LENGTH          $content_length;

fastcgi_param   SCRIPT_FILENAME         $request_filename;
fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;
fastcgi_param   REQUEST_URI             $request_uri;
fastcgi_param   DOCUMENT_URI            $document_uri;
fastcgi_param   DOCUMENT_ROOT           $document_root;
fastcgi_param   SERVER_PROTOCOL         $server_protocol;

fastcgi_param   GATEWAY_INTERFACE       CGI/1.1;
fastcgi_param   SERVER_SOFTWARE         nginx/$nginx_version;

fastcgi_param   REMOTE_ADDR             $remote_addr;
fastcgi_param   REMOTE_PORT             $remote_port;
fastcgi_param   SERVER_ADDR             $server_addr;
fastcgi_param   SERVER_PORT             $server_port;
fastcgi_param   SERVER_NAME             $server_name;

fastcgi_param   HTTPS                   $https;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param   REDIRECT_STATUS         200;
fastcgi_param PATH_INFO "";

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

site-avalaible/default (i made so many tries, here what it is now) :

server {

 listen 8045;

        server_name ptitest;
        root /usr/share/nginx/asproot;

        access_log /var/log/nginx/asp.access.log;

        error_log /var/log/nginx/asp.error.log;

location ~ \.(aspx|asmx|ashx|asax|ascx|soap|rem|axd|cs|config|dll)$ {
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
        fastcgi_intercept_errors on;


location / {
        root html;
        index index.html index.htm default.aspx Default.aspx;


Web Content : /usr/share/nginx/asproot/web.config :



<customErrors mode="Off"/>




<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <% var test = String.Format("Hello World! Got an aspx page running on nginx!!!\r\n{0}",System.DateTime.Now); %>

    <%= test %>


| improve this answer | |
  • Seems to be mostly fine as far as I can see, only a recomendation - don't use fastcgi-mono-server4. I recommend using Hyperfastcgi (github.com/xplicit/HyperFastCgi) - it's a rewrite to make it more performant - the mono one is damn slow. It uses a very similar config, so shouldn't be a problem migrating to it. – Evengard Aug 19 '15 at 13:50
  • And in your command line for mono-fastcgi specify MONO_IOMAP=all - that should fix the case issue. – Evengard Aug 19 '15 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.