XAMPP 上的虚拟主机 [英] VirtualHost on XAMPP
问题描述
我在 Windows 7 上使用 XAMPP lite,但我希望将 http://mycustomname
映射到目录而不是 http://localhost
myfolder
在 root/htdocs 中.
I'm using XAMPP lite on Windows 7, but instead of http://localhost
I'd like to have http://mycustomname
mapped to a directory myfolder
in root/htdocs.
我应该在 httpd.conf 中更改什么?
What should I change in httpd.conf?
非常感谢!
推荐答案
添加到你的 xamppapacheconfextrahttpd-vhosts.conf 文件:
Add to your xamppapacheconfextrahttpd-vhosts.conf file:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mycustomname
ServerAlias mycustomname
DocumentRoot "c:xampphtdocsmyfolder"
</VirtualHost>
现在编辑 c:windowssystem32driversetchosts 并添加一个新行:
Now edit c:windowssystem32driversetchosts and add a new line:
127.0.0.1 mycustomname
这将导致 Windows 将您的自定义名称解析为 127.0.0.1.重启 Apache,你就可以访问你的网站了.
Which will cause Windows to resolve your custom name to 127.0.0.1. Restart Apache and you can access your site.
这篇关于XAMPP 上的虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!