XAMPP 上的虚拟主机 [英] VirtualHost on XAMPP

查看:25
本文介绍了XAMPP 上的虚拟主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 7 上使用 XAMPP lite,但我希望将 http://mycustomname 映射到目录而不是 http://localhostmyfolder 在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆