虚拟主机上的服务器名称无效

时间:2014-07-27 17:44:41

标签: php apache zend-framework frameworks

我需要你的帮助。我正在开发一个zend框架2项目,该项目在Wamp / www文件夹中的名称是pizza。 我尝试在hosts文件httpd.conf和httpd-vhosts.conf上配置虚拟主机以使用此项目url:pizza.local /

而不是:localhost:8080 / pizza / public /

但是我的配置并不重要。 请注意,我使用的是localhost:8080而不是localhost。

请帮我找出我做错了什么。这是我的文件:

的httpd.conf:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

的httpd-vhosts.conf:

<VirtualHost *:8080>
    ServerAdmin webmaster@localhost.com
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias www.localhost
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

<VirtualHost *:8080>
    DocumentRoot "c:/wamp/www/pizza/public"
    ServerName pizza.local
    <Directory "c:/wamp/www/pizza/public">
    DirectoryIndex index.php
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>

主持文件:

# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

127.0.0.1       localhost
127.0.0.1   pizza.local
127.0.0.1       localhost

1 个答案:

答案 0 :(得分:0)

当您在端口8080上使用此VHOST时。您需要在URL中提及如下。

http://pizza.local:8080/