如何在本地计算机上添加子域
我修改了我的 etc/hosts 文件(在 Windows 7 下),以便 www.example.com
和 demo.example.com
都指向 localhost.不幸的是,访问 demo.example.com 会将我带到本地主机的文档根目录(这是合乎逻辑的)。我想将其更改为将
demo.example.com
指向 demo.localhost
,因此在 localhost 上创建一个新的虚拟子域,然后 etc/hosts 文件应该可以正常工作。
有人能指出我正确的方向吗?我有这个虚拟主机文件,它具有有效的语法,但似乎没有按我想要的方式工作。
<VirtualHost 127.0.0.1:80>
ServerPath /demo-example/
ServerName demo.example.com
</VirtualHost>
I have modified my etc/hosts file (under Windows 7), so that www.example.com
and demo.example.com
both point at localhost
. Unfortunately accessing demo.example.com
, takes me to localhost's document root (which is logical). I want to change this to point demo.example.com
to demo.localhost
, so make a new virtual subdomain on localhost and then the etc/hosts file should do it's work.
Could anyone point me in the right direction? I have this vhosts file, which has a valid syntax, but doesn't seem to be working as I want.
<VirtualHost 127.0.0.1:80>
ServerPath /demo-example/
ServerName demo.example.com
</VirtualHost>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试像这样更改端口号
try to change the port number like this