简体   繁体   English

如何在Zend Server上创建VirtualHost?

[英]How do I create a VirtualHost on Zend Server?

I am using zend server and I added one VirtualHost into the extra/httpd-vhosts.conf file and removed # from the httpd.conf file. 我正在使用zend服务器,我在extra / httpd-vhosts.conf文件中添加了一个VirtualHost,并从httpd.conf文件中删除了#。

This is what I added into the extra/httpd-vhosts.conf file: 这是我在extra / httpd-vhosts.conf文件中添加的内容:

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>

When I access quickstart.local it is working fine, but it also affects localhost (ie when I try to load http://localhost/ , I see the same site I do for http://quickstart.local/ . 当我访问quickstart.local它工作正常,但它也影响localhost(即当我尝试加载http:// localhost /时 ,我看到我为http://quickstart.local/做的同一个站点。

How do I resolve this issue? 我该如何解决这个问题? I want both localhost (I use this for another project) and quickstart.local to be separate. 我想要localhost(我将其用于另一个项目)和quickstart.local分开。

I have the same problem. 我也有同样的问题。 Try to add a host to zend.conf or add 尝试将主机添加到zend.conf或添加

Include conf/extra/httpd-vhosts.conf                   

to htppd.conf 到htppd.conf

You can add a new vhost by adding the directives to a new file: 您可以通过将指令添加到新文件来添加新的vhost:

/path/to/zend/etc/sites.d/vhost_[my-site].conf

Replace [my-site] with whatever you want (no spaces). [my-site]替换[my-site]您想要的任何内容(无空格)。

Then, be sure you restart apache : 然后,请确保重新启动apache

sudo /path/to/zend/bin/apachectl restart

I had similar issue when trying to add own sites. 在尝试添加自己的网站时,我遇到了类似的问题。 Solution for me was to comment both vhost examples in vhosts file and also uncomment or add the 我的解决方案是在vhosts文件中注释两个vhost示例,并取消注释或添加

127.0.0.1 localhost 

into hosts file in %windir%/system32/drivers/etc folder 进入%windir%/ system32 / drivers / etc文件夹中的hosts文件

... ofcourse if you need to uncomment vhost_alias module and include for httpd-vhosts file.. ...当然如果您需要取消注释vhost_alias模块并包含httpd-vhosts文件..

[FILE PATH] \\xampp\\apache\\conf\\extra\\httpd-vhosts.conf or, if you are using Apache 2.4 or above: [FILE PATH] \\ xampp \\ apache \\ conf \\ extra \\ httpd-vhosts.conf或者,如果您使用的是Apache 2.4或更高版本:

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

After change. 改变之后。 C:\\Windows\\System32\\drivers\\etc\\hosts C:\\ WINDOWS \\ SYSTEM32 \\ DRIVERS \\ ETC \\主机

127.0.0.1       dev.zendapp

Restart Your xampp Server 重新启动您的xampp服务器

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

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