参考:apache 二级域名设置完整步骤
https://www.cnblogs.com/phonecom/p/6363268.html
一级域名 localhost 指向根目录
二级域名 emoji.localhost 指向特定目录
修改 http.conf,或者修改 httpd-vhosts.conf,如果是后者要检查下 http.conf 文件的 Include "conf/extra/httpd-vhosts.conf"是否打开了
在 D:\xampp\apache\conf\extra\httpd-vhosts.conf 尾部添加如下内容
顶级域名指定一个目录
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot "D:/aaa"
ServerName localhost
ErrorLog "D:\xampp\apache\logs\error.log"
CustomLog "D:\xampp\apache\logs\access.log" combined
</VirtualHost>
二级域名指定一个目录
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot "D:/aaa/emoji"
ServerName emoji.localhost
ErrorLog "D:\xampp\apache\logs\emoji-error.log"
CustomLog "D:\xampp\apache\logs\emoji.access.log" combined
</VirtualHost>
网友评论