日期:2014-05-16  浏览次数:20659 次

xp apache 基于域名的虚拟主机的相关配置
1步:
Apache Software Foundation\Apache2.2\conf\httpd.conf
httpd.conf配置

listen : 80
NameVirtualHost *
<VirtualHost *>
    <Directory 要访问的文件夹所在路径>#如:"D:\www\dummy-myhost.com\upload"
        Options -Indexes FollowSymLinks
        Allow from all
        AllowOverride All
    </Directory>
    ServerAdmin admin@dummy-myhost.com
    DocumentRoot 要访问的文件夹所在路径 #如:"D:\www\dummy-myhost.com\upload"

    ServerName dummy-myhost.com:80 #服务器名:端口
    ServerAlias *.dummy-myhost.com #服务器别名
    ErrorLog "D:/www/dummy-myhost.com/logs/dummy-myhost.com-error_log.log"#日志文件存放位置
    CustomLog "D:/www/dummy-myhost.com/logs/dummy-myhost.com-access.log" common#访问记录文件存放位置
</VirtualHost>

2.步

C:\WINDOWS\system32\drivers\etc\hosts

hosts文件配置 域名 IP 映射

如:

#127.0.0.1 test.ecshop.com
192.168.2.114  www.dummy-myhost.com



ok!