简体   繁体   English

虚拟主机上的服务器名称不起作用

[英]Server name on virtual host not working

please i need your help. 拜托我需要你的帮忙。 I am working on a zend framework 2 project, the project's name in Wamp/www folder is pizza. 我正在一个zend framework 2项目上,该项目在Wamp / www文件夹中的名称是Pizza。 i tried to configure a virtual host on hosts file,httpd.conf and httpd-vhosts.conf to work with this project url: pizza.local/ 我试图在主机文件,httpd.conf和httpd-vhosts.conf上配置虚拟主机,以使用此项目url:pizza.local /

instead of this: localhost:8080/pizza/public/ 而不是这样:localhost:8080 / pizza / public /

but something is not ght with my configuration. 但是我的配置不正确。 note that I am using localhost:8080 not localhost. 请注意,我使用的是localhost:8080,而不是localhost。

Please help me to find what I did wrong. 请帮助我找出我做错了什么。 Here's my files: 这是我的文件:

httpd.conf: httpd.conf中:

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

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>

hosts file: 主机文件:

# 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

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

http://pizza.local:8080/

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

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