nginx 更多 fastcgi-mono-server

nginx 更多 fastcgi-mono-server

我一直在寻找与我的问题相关的帖子,但没找到。我绝望了,我按照指南使用 fastcgi-mono-server 安装和配置 nginx (http://www.mono-project.com/FastCGI_Nginx),我按照指南中说的所有方法做了,但我就是无法让 nginx 解释 asp 页面。

我的配置页面在 /etc/nginx/sites-available/default:

server{
    listen   80;
    server_name  prueba;
    access_log   /var/log/nginx/prueba.access.log;

    location / {
        root /var/www/prueba/;
        index index.html index.htm default.aspx Default.aspx;
        fastcgi_index Default.aspx;
        fastcgi_pass 127.0.0.1:9000;
        include /etc/nginx/fastcgi_params;
    }
}

/etc/nginx/fastcgi_params的配置:

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;

fastcgi_param  PATH_INFO          "";
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

fastcgi_param   REDIRECT_STATUS         200;

我在 /var/www/prueba/ 中创建了一个 Default.aspx 页面

现在我运行:

fastcgi-mono-server2 /应用程序=prueba:/:/var/www/prueba/ /socket=tcp:127.0.0.1:9000

之后,我启动 nginx:

/etc/init.d/nginx 启动

当我尝试访问“http://本地主机/“ 或者 ”http://本地主机:80/“ 给我看看:

No Application Found

Unable to find a matching application for rquest:

    Host localhost
    Port 80
    Request Path /Default.aspx
    Physical Path /var/www/prueba/Default.aspx

我希望你可以帮助我。

答案1

当启动 fastcgi-mono-server 时我认为它应该是这样的:

fastcgi-mono-server2 /applications=/prueba:/var/www/prueba/ /socket=tcp:127.0.0.1:9000

我个人使用这一行来运行它:

MONO_IOMAP=all  fastcgi-mono-server4 /socket=tcp:9000 /address=127.0.0.1 /applications=/:.,/dlr:/var/www/dotnet/dlr /logfile=/var/log/lighttpd/fastcgi.log &

如您所见,我使用的是 fastcgi-mono-server4。它的工作方式可能相同。

答案2

为了诊断此类错误,请尝试在运行 fastcgi-mono-server 时添加其他参数:

/printlog=True /loglevel=All /verbose=True

因此,您将在控制台中看到发送了哪个应用程序请求。

错误配置的服务器的输出示例:

[2014-09-30 02:47:45Z] Notice  Beginning to receive records on connection.
No application defined for: 127.0.0.1:80/default.aspx
[2014-09-30 02:47:45Z] Notice  Finished receiving records on connection.

答案3

fastcgi_index Default.aspx;您应该在配置中删除或者注释掉。

答案4

添加:

proxy_set_header Host $host;

到你的 nginx.conf

相关内容