繁体   English   中英

Xampp中Zend Framework 2的vhost配置(Windows)

[英]vhost config for Zend Framework 2 in Xampp (windows)

我已经在xamp(Windows)中安装了zend framework 2,并且在我调用http://localhost/zf2-tutorial/public/时可以访问它。 我正在尝试使用httpd-vhosts.conf使用以下配置来设置虚拟主机

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

并已在主机文件中配置127.0.0.1 zf2-tutorial.localhost 但是当我在浏览器中调用zf2-tutorial.localhost时,我得到的只是http://zf2-tutorial.localhost/xampp/ 我还尝试将其添加到httpd.conf ,结果仍然相同。 请帮忙 ?

如果您在文件httpd-vhost.com配置虚拟主机,请确保在httpd.conf文件中未注释虚拟主机包含文件,即从Include conf/extra/httpd-vhosts.conf行的开头删除#。

我个人不喜欢xammp软件,而是设置我自己的apache,但是设置项目应该不会有太多差异。 我还喜欢为项目使用别名,而不是通过“ localhost”或“ ip”访问它们。 我的配置通常看起来像这样:

<VirtualHost *:80>
    ServerName tutorial.local
    ServerAlias tutorial.local
    DocumentRoot c:/Apache24/htdocs/tutorial/public/
    SetEnv APPLICATION_ENV "development"

    <Directory c:/Apache24/htdocs/tutorial/public/>
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

在使用别名设置虚拟主机之后,您必须在FILESYSTEM:\\windows\\System32\\drivers\\etc\\打开主机文件并添加主机。

localhost or IP  tutorial.local

请记住,您将必须以管理员身份打开此文件,并且可能会禁用防病毒/间谍阻止程序。

我终于找到了问题所在,我从未为本地主机添加虚拟主机。 一次,我像这样在httpd-vhost.cong中配置了本地主机,它运行良好。 感谢你的帮助

<VirtualHost *:80>
  DocumentRoot "D:\xampp\htdocs"
  ServerName localhost
</VirtualHost>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM