這幾天又玩了一下Apache HTTP Server
Apache有著強大的Web伺服器配置功能,不然也不會成為全球使用量最大的Web伺服器架設工具,不過預設安裝的Apache不能運行asp.net,太可惜了,因為最近玩Asp.net所以迫切要求在Apache上面能運行Asp.net,網上找了下,很快就有了答案:
http://weblogs.asp.net/israelio/archive/2005/09/11/424852.aspx
稍作解釋:
http://www.apache.org/dist/httpd/binaries/win32/
下載Apache HTTP Server最新的MSI Installer Package或Installer Package進行安裝
http://www.apache.org/dist/httpd/mod_aspdotnet/
下載mod_aspdotnet最新的MSI Installer Package進行安裝
然後編輯Apache的設定檔httpd.conf,在最後加上以下內容:
#asp.net
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo
<IfModule mod_aspdotnet.cpp>
# 載入 ASP.NET /asp 應用程式
AspNetMount /SampleASP "c:/SampleASP"
Alias /SampleASP "c:/SampleASP"
#/SampleASP 相當於IIS中的虛擬目錄,指向"c:/SampleASP",可自訂修改
# 運行http://localhost/SampleASP 查看
# 設定目錄許可權
<Directory "c:/SampleASP">
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex index.htm index.aspx
#這句相當於IIS中設定預設文件
</Directory>
# 指定aspnet_client目錄路徑
AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
<Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
</IfModule>
#asp.net
C:/SampleASP及其別名——虛擬目錄名可自訂修改,儲存,Restart Apache.
在SampleASP中添加index.aspx檔案,在http://localhost/SampleASP/index.aspx進行測試.
完畢!