如何让apache同时支持php和asp.net两种环境呢?百度一下有相关文章
但是都没有讲如何配置虚拟主机和解析独立域名
PHP我就不多说了,百度一下一大把.下面重点讲解如何让配置.net环境
1.安装好apache2.2和PHP环境.
2.下载mod_aspdotnet,一路默认安装. 点击下载: mod_aspdotnet
3.打开httpd.conf 中虚拟主机模块.
4.找到打开 httpd-vhosts.conf 并添加以下代码
<VirtualHost *:80>
#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>
# Mount the ASP.NET example application
AspNetMount / “网站根目录 如: D:/www/net”
# Map all requests for /active to the application files
#Alias /active “C:/Program Files/Apache Group/Apache2/htdocs/active”
# Allow asp.net scripts to be executed in the active example
<Directory “网站根目录“>
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex Default.htm Default.aspx index.aspx
</Directory>
# For all virtual ASP.NET webs, we need the aspnet_client files
# to serve the client-side helper scripts.
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>
ServerName net.com
ServerAlias 网站域名
DocumentRoot “网站根目录”
<Directory “网站根目录“>
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex Default.htm Default.aspx index.aspx
</Directory>
</VirtualHost>
如果懒得复制可以下载 TXT文件点击下载: asp.net
重启Apache.
至此Apache2.2就可以支持Asp.net和php了.
评论回复