Mono through FastCGI on nginx

Posted by Stijn on Server Fault See other posts from Server Fault or by Stijn
Published on 2012-04-15T20:36:45Z Indexed on 2012/04/15 23:32 UTC
Read the original article Hit count: 684

Filed under:
|
|
|

I'm going through http://www.mono-project.com/FastCGI_Nginx and can't get it to work. The FastCGI server seems to be running. The following is from the error log:

upstream sent unexpected FastCGI record: 3 while reading response header from upstream, client: 192.168.1.125, server: arch, request: "GET /Default.aspx HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "arch"

Command used to start the server (I've tried server2 and server4, using a simple .NET 2.0 or .NET 4.0 project):

fastcgi-mono-server2 /applications=arch:/:/var/www/test/public/ /socket=tcp:127.0.0.1:9000 /stopable=True

nginx config:

server
{
    listen 80;
    server_name arch;

    access_log /var/www/test/log/access.log;
    error_log /var/www/test/log/error.log;

    location /
    {
        root /var/www/test/public;
        index index.html index.htm default.aspx Default.aspx;
        fastcgi_index Default.aspx;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param  PATH_INFO          "";
        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    }
}

Using xsp4 works fine, I can browse the site.

I've enabled FastCGI logging, this is the output:

[2012-04-15 23:51:18Z] Debug   Accepting an incoming connection.
[2012-04-15 23:51:18Z] Notice  Beginning to receive records on connection.
[2012-04-15 23:51:18Z] Debug   Record received. (Type: BeginRequest, ID: 1, Length: 8)
[2012-04-15 23:51:18Z] Debug   Record received. (Type: Params, ID: 1, Length: 386)
[2012-04-15 23:51:18Z] Debug   Record received. (Type: Params, ID: 1, Length: 0)
[2012-04-15 23:51:18Z] Debug   Read parameter. (PATH_INFO = )
[2012-04-15 23:51:18Z] Debug   Read parameter. (SCRIPT_FILENAME = /var/www/test/public/Home)
[2012-04-15 23:51:18Z] Debug   Read parameter. (HTTP_HOST = arch)
[2012-04-15 23:51:18Z] Debug   Read parameter. (HTTP_USER_AGENT = Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0)
[2012-04-15 23:51:18Z] Debug   Read parameter. (HTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8)
[2012-04-15 23:51:18Z] Debug   Read parameter. (HTTP_ACCEPT_LANGUAGE = en-gb,en;q=0.5)
[2012-04-15 23:51:18Z] Debug   Read parameter. (HTTP_ACCEPT_ENCODING = gzip, deflate)
[2012-04-15 23:51:18Z] Debug   Read parameter. (HTTP_CONNECTION = keep-alive)
[2012-04-15 23:51:18Z] Debug   Read parameter. (HTTP_COOKIE = ASP.NET_SessionId=2C3D702C9B0F23F69B80820B)
[2012-04-15 23:51:18Z] Error   Failed to process connection. Reason: Argument cannot be null.
Parameter name: s
[2012-04-15 23:51:18Z] Debug   Record sent. (Type: EndRequest, ID: 1, Length: 8)
[2012-04-15 23:51:18Z] Debug   The FastCGI connection has been closed.

© Server Fault or respective owner

Related posts about nginx

Related posts about fastcgi