Apache 使用vhosts配置设置项目的服务器
Zend框架对我来说是新的,我正在从一本书中学习,所以我可以对书中的内容有一个初步的了解。这本书是Zend框架的初学者指南 我已经设置了我的项目,并在一个名为test的文件夹中创建了它 我还添加了一个vhost,vhost文件包含:Apache 使用vhosts配置设置项目的服务器,apache,zend-framework,vhosts,Apache,Zend Framework,Vhosts,Zend框架对我来说是新的,我正在从一本书中学习,所以我可以对书中的内容有一个初步的了解。这本书是Zend框架的初学者指南 我已经设置了我的项目,并在一个名为test的文件夹中创建了它 我还添加了一个vhost,vhost文件包含: <VirtualHost *:80> DocumentRoot "C:/Program Files/Zend/Apache2/htdocs/test/public" ServerName .localtest # This shoul
<VirtualHost *:80>
DocumentRoot "C:/Program Files/Zend/Apache2/htdocs/test/public"
ServerName .localtest
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "C:/Program Files/Zend/Apache2/htdocs/test/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
我的问题是,当我浏览到zend server测试页面时,当我阅读到zend Framework项目主页时,我可以通过浏览到
我遗漏了什么吗?试着改变一下
<VirtualHost *:80>
DocumentRoot "C:/Program Files/Zend/Apache2/htdocs/test/public"
ServerName .localtest
并添加此代码
<VirtualHost *:80>
ServerName test.localtest
DocumentRoot "C:/Program Files/Zend/Apache2/htdocs/test/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/Program Files/Zend/Apache2/htdocs/test/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
再加上这一行
127.0.0.1 test.localtest
然后别忘了重新启动apache服务器wamp或xampp或您正在使用的任何东西
然后打开这个链接
http://test.localtest
尝试使用http://编写url。如果没有http://浏览器有时无法工作://
如果不起作用,请尝试注释尝试更改
<VirtualHost *:80>
DocumentRoot "C:/Program Files/Zend/Apache2/htdocs/test/public"
ServerName .localtest
并添加此代码
<VirtualHost *:80>
ServerName test.localtest
DocumentRoot "C:/Program Files/Zend/Apache2/htdocs/test/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/Program Files/Zend/Apache2/htdocs/test/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
再加上这一行
127.0.0.1 test.localtest
然后别忘了重新启动apache服务器wamp或xampp或您正在使用的任何东西
然后打开这个链接
http://test.localtest
尝试使用http://编写url。如果没有http://浏览器有时无法工作://
如果它不起作用,请尝试发表评论有一件事大家都忽略了,那就是Zf在大多数情况下都需要以下语法链接才能起作用 这是我通常在vhost中使用的目录定义
<directory "C:\www\project">
Options Indexes FollowSymlinks
AllowOverride all
Order Deny,Allow
Allow from all
</directory>
在apache中启用make vhosts:
Include conf/extra/httpd-vhosts.conf //make sure this line is uncommented httpd.conf
确保该行存在于vhosts文件中,通常位于vhosts定义之上:
NameVirtualHost *:80
大多数人都忽略了一件事,那就是采埃孚在大多数情况下都需要使用以下符号链接 这是我通常在vhost中使用的目录定义
<directory "C:\www\project">
Options Indexes FollowSymlinks
AllowOverride all
Order Deny,Allow
Allow from all
</directory>
在apache中启用make vhosts:
Include conf/extra/httpd-vhosts.conf //make sure this line is uncommented httpd.conf
确保该行存在于vhosts文件中,通常位于vhosts定义之上:
NameVirtualHost *:80
感谢您的回复,但这只是给了我与Zend Server测试页面相同的结果..:@user1117324我已将您的答案从C:\WINDOWS\system32\drivers\etc编辑为C:\WINDOWS\system32\drivers\etc\hosts,C:\WINDOWS\system32\drivers\etc是一个目录。感谢您的回复,但这只会给我Zend Server测试页的相同结果..:@user1117324我已将您的答案从C:\WINDOWS\system32\drivers\etc编辑为C:\WINDOWS\system32\drivers\etc\hosts,C:\WINDOWS\system32\drivers\etc是一个目录。我在vhosts文件名virtualhost*中遗漏了这行代码:80非常感谢:我在vhosts文件名virtualhost*中遗漏了这行代码:80非常感谢: