在本地主机上设置虚拟主机
我正在按照线程在 stackoverflow 上设置虚拟主机。我
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/www/test"
ServerName test.devsite-1.com
ServerAlias test.devsite-1.com
</VirtualHost>
在 Windows 主机文件中
127.0.0.1 test.devsite-1.com
执行了以下操作,我在浏览器中点击了以下网址
http://test.devsite-1.com/< /a>
结果页面显示了文件夹列表,即本地主机页面...正如我所期望的,它将显示放置在 /test 文件夹中的 index.php 的内容?
如果我解释错误,有人可以纠正我吗?
问候
I am following the threads to set up a virtual host on stackoverflow. i did follwoing
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/www/test"
ServerName test.devsite-1.com
ServerAlias test.devsite-1.com
</VirtualHost>
in windows host file
127.0.0.1 test.devsite-1.com
I hit following url in browser
The resulting page shows me the listing of folder i.e localhost page... where as I was expecting it will show the content of index.php placed in /test folder?
Can someone correct me if I am interpreting something wrong?
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果向您显示测试文件夹的内容,那么您可能需要将 index.php 定义为索引。
您可以首先尝试在目录中使用 index.html 文件,但我相信您在虚拟主机配置中缺少 DirectoryIndex 指令。
尝试添加:
到您的虚拟主机配置中。
If you are being shown the contents of your test folder then maybe you need to define index.php as an index.
You could attempt with a index.html file inside the directory first, but i believe you are missing the DirectoryIndex directive in your Virtualhost configuration.
Try adding:
to your Virtualhost configuration.
尝试添加
到您的虚拟主机。
顺便说一句:我建议使用某种 test.devsite-1.local,这样您就不会意外阻止真正的 test.devsite-1.com。
Try adding
to your virtualhost.
BTW: I would recommend using some kind of test.devsite-1.local so you don't accidently block the real test.devsite-1.com.