【问题标题】:wamp subdomain alias strange behaviourwamp 子域别名奇怪的行为
【发布时间】:2013-01-04 04:53:01
【问题描述】:

我在 Windows 7 上使用 WAMP

已经制作了zf2-tutorial.localhost的别名,添加到drivers/etc/hosts 还启用了虚拟主机设置:

Include conf/extra/httpd-vhosts.conf

已经根据这个在这个文件中设置了我的别名

<VirtualHost *:80>
    ServerName zf2-tutorial.localhost
    DocumentRoot /path/to/zf2-tutorial/public
    SetEnv APPLICATION_ENV "development"
    <Directory /path/to/zf2-tutorial/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

当我打开 zf2-tutorial.localhost 时,它会按预期显示 zend 页面。但是当我试图打开 localhost 页面时,它会显示:

Forbidden

You don't have permission to access / on this server.

在 httpd.conf 中禁用虚拟主机,允许打开 localhost 但无法打开 zf2-tutorial.localhost

【问题讨论】:

    标签: php mod-rewrite localhost wamp alias


    【解决方案1】:

    可能重复here

    为了能够在启用虚拟主机时访问 localhost,您的 httpd-vhosts.conf 中的第一个条目需要命名为 localhost 并链接到您的 Web 根目录。

    <VirtualHost *:80>
         ServerName localhost
         DocumentRoot "path/to/your/www/folder"
    </VirtualHost>
    <VirtualHost *:80>
        ServerName zf2-tutorial.localhost
        DocumentRoot /path/to/zf2-tutorial/public
        SetEnv APPLICATION_ENV "development"
        <Directory /path/to/zf2-tutorial/public>
            DirectoryIndex index.php
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    

    请参阅Setup Apache to serve multiple sites 的第三步中的示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-13
      • 1970-01-01
      • 2018-01-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多