Apache 如何在Zend服务器上创建VirtualHost?
我正在使用zend server,我在extra/httpd-vhosts.conf文件中添加了一个VirtualHost,并从httpd.conf文件中删除了 这是我在extra/httpd-vhosts.conf文件中添加的内容:Apache 如何在Zend服务器上创建VirtualHost?,apache,virtualhost,virtual-hosts,Apache,Virtualhost,Virtual Hosts,我正在使用zend server,我在extra/httpd-vhosts.conf文件中添加了一个VirtualHost,并从httpd.conf文件中删除了 这是我在extra/httpd-vhosts.conf文件中添加的内容: NameVirtualHost *:80 <VirtualHost *:80> ServerName quickstart.local DocumentRoot D:/quickstart/Code <Directo
NameVirtualHost *:80
<VirtualHost *:80>
ServerName quickstart.local
DocumentRoot D:/quickstart/Code
<Directory D:/quickstart/Code>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
NameVirtualHost*:80
ServerName quickstart.local
DocumentRoot D:/quickstart/Code
DirectoryIndex.php
允许超越所有
命令允许,拒绝
通融
当我访问quickstart.local时,它工作正常,但它也会影响localhost(即当我尝试加载时,我看到的是我为其创建的相同站点)
如何解决此问题?我希望localhost(我在另一个项目中使用此选项)和quickstart.local分开。我有相同的问题。请尝试将主机添加到zend.conf或 加
在htppd.conf中,您可以通过向新文件添加指令来添加新vhost:
/path/to/zend/etc/sites.d/vhost_[my-site].conf
将[my site]
替换为您想要的任何内容(无空格)
然后,确保重新启动apache:
sudo /path/to/zend/bin/apachectl restart
我在尝试添加自己的站点时遇到了类似的问题。我的解决方案是在vhosts文件中注释vhost示例,并取消注释或添加
127.0.0.1 localhost
进入%windir%/system32/drivers/etc文件夹中的主机文件
…当然,如果您需要取消注释vhost_别名模块并包含用于httpd vhosts文件
[文件路径]\xampp\apache\conf\extra\httpd-vhosts.conf或
使用Apache 2.4或更高版本:
重新启动xampp服务器
取消对该行的注释:在htppd.conf文件中包含conf/extra/httpd-vhosts.conf,并将指令添加到相应的位于C:\Program Files…\Zend\Apache2\conf\extra目录中的httpd-vhosts.conf。在windows中,您可能还需要向主机文件添加一行指令
127.0.0.1 localhost
<VirtualHost *:80>
ServerName dev.zendapp
DocumentRoot "G:/xampp/htdocs/io2018/zend2018/zendApps"
SetEnv APPLICATION_ENV "development"
<Directory "G:/xampp/htdocs/io2018/zend2018/zendApps">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
127.0.0.1 dev.zendapp