【问题标题】:How to add subdomain on local machine如何在本地机器上添加子域
【发布时间】:2012-02-10 11:12:23
【问题描述】:

我已经修改了我的 etc/hosts 文件(在 Windows 7 下),所以 www.example.comdemo.example.com 都指向 localhost。不幸的是,访问demo.example.com 会将我带到本地主机的文档根目录(这是合乎逻辑的)。我想将其更改为将demo.example.com 指向demo.localhost,因此在 localhost 上创建一个新的虚拟子域,然后 etc/hosts 文件应该可以正常工作。

谁能指出我正确的方向?我有这个 vhosts 文件,它具有有效的语法,但似乎没有按我的意愿工作。

<VirtualHost 127.0.0.1:80>
ServerPath /demo-example/
ServerName demo.example.com
</VirtualHost>

【问题讨论】:

    标签: apache subdomain vhosts


    【解决方案1】:

    尝试像这样更改端口号

    <VirtualHost 127.0.0.1:8080>
        ServerPath /demo-example/
        ServerName demo.example.com
    </VirtualHost>
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-11-12
    • 1970-01-01
    • 2016-07-30
    • 2016-12-18
    • 2013-09-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多