我在 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