如何在 Mac 上设置虚拟主机(本地)
如何在我的 Mac 上设置虚拟主机。通过向主机文件添加 127.0.0.1
行并编辑 apache 配置应该很容易。但由于某种原因,它对我不起作用...
不,MAMP 不是一个选项,因为您无法在 MAMP 中设置虚拟主机(除非您购买 MAMP Pro...)
有什么建议吗?
How can I setup a virtual hosting on my Mac. It should be easy by adding a 127.0.0.1
line to the hosts file and editing the apache configuration. But for some reason, it doesn't work with me...
And no, MAMP is not an option since you can't setup vhosts in MAMP (except if you buy the MAMP Pro...)
Any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它工作得很好,我在 apache 下的 OS X 机器上设置了几个虚拟主机。确保您使用的是基于名称的虚拟主机,并且如果您使用的是随 OS X 一起分发的 apache,并且 vhosts 配置位于单独的文件中(例如在 /etc/apache2/other/httpd-vhosts.conf 中)它实际上正在被纳入其中。此外,您始终可以测试 apachectl -t -D DUMP_VHOSTS 来查看虚拟主机是否真正被定义。
It works just fine, i have several vhosts set up on my OS X box under apache. Make sure that you are using name-based virtual hosting AND that if you are using apache that is distributed with OS X and the vhosts config is in a separate file (e.g. in /etc/apache2/other/httpd-vhosts.conf) that it is actually getting included. Also you can always test
apachectl -t -D DUMP_VHOSTS
to see if the virtual hosts are actually getting defined.