2011-08-05 31 views
2

我想在Nginx上設置一個Mono ASP.NET,但似乎索引優先級不起作用。 如果我使用http://www.mono-project.com/FastCGI_Nginx的例子如下:FastCGI和Nginx錯誤索引文件的優先級

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

後來,當我參觀http://localhost/,它總是會要求Default.aspx,如果沒有這樣的文件,Web服務器將顯示404錯誤。

我試圖找到通過搜索問題的答案,我發現這一個: asp mvc home root not working with mono, fastcgi and nginx

所以我想我遇到了同樣的問題,然後我修改配置文件如下:

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

即使在htdocs文件夾中只有一個.aspx文件(如random.aspx),網絡服務器仍然會請求.aspx文件作爲優先級,但它仍將在index.htm之前顯示它。

,然後當我刪除了所有的FastCGI相關配置如下:

location/{ 
     root /srv/www/htdocs/; 
     index index.htm index.html default.aspx Default.aspx; 
    } 

只有這樣的指標優先正常工作。

那麼,誰能告訴我,爲什麼會發生這種情況呢?我需要修改與FastCGI相關的任何配置文件嗎?

回答

2

確保您的monoserve中的fastcgi設置指向有效路徑。

fastcgi-mono-server2 /applications=www.domain1.xyz:/**:/var/www/www.domain1.xyz**/ /socket=tcp:127.0.0.1:9000 

/var/www/www.domain1.xyz/必須指向您的Web應用程序的根目錄。