2013-08-25 35 views
0

我之前创建了两个VirtualHost,即[localhost]和“phpsite”。昨天我将“phpsite”改名为“phppages”,并增加了一个名为“techsupport.com”的虚拟主机。我在我的Apache服务器上使用端口8088。但是现在我可以使用[localhost]:8088和phpsite:8088,尽管没有名为“phpsite”的虚拟主机,如果我选择techsupport.com:8088,我什么也得不到。Apache 2.4.4 WAMP VHosts错误

这里是我的虚拟主机内容:

# Virtual Hosts 
# 
# Required modules: mod_log_config 

# If you want to maintain multiple domains/hostnames on your 
# machine you can setup VirtualHost containers for them. Most configurations 
# use only name-based virtual hosts so the server doesn't need to worry about 
# IP addresses. This is indicated by the asterisks in the directives below. 
# 
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/> 
# for further details before you try to setup virtual hosts. 
# 
# You may use the command line option '-S' to verify your virtual host 
# configuration. 

# 
# VirtualHost example: 
# Almost any Apache directive may go into a VirtualHost container. 
# The first VirtualHost section is used for all requests that do not 
# match a ServerName or ServerAlias in any <VirtualHost> block. 
# 
#<VirtualHost *:80> 
# ServerAdmin [email protected] 
# DocumentRoot "c:/Apache24/docs/dummy-host.example.com" 
# ServerName dummy-host.example.com 
# ServerAlias www.dummy-host.example.com 
# ErrorLog "logs/dummy-host.example.com-error.log" 
# CustomLog "logs/dummy-host.example.com-access.log" common 
#</VirtualHost> 

#<VirtualHost *:80> 
# ServerAdmin [email protected] 
# 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 *:8088> 
    ServerAdmin [email protected] 
    DocumentRoot "c:/wamp/www" 
    ServerName localhost 
    ServerAlias www.localhost.com 
    ErrorLog "logs/localhost-error.log" 
    CustomLog "logs/localhost-access.log" common 
    <Directory "c:/wamp/www"> 
     Order Deny,Allow 
     Deny from all 
     Allow from 127.0.0.1 localhost ::1 
    </Directory> 
</VirtualHost> 

<VirtualHost *:8088> 
    DocumentRoot "e:/techsupport" 
    ServerName techsupport.com 
    ServerAlias www.techsupport.com 
    ErrorLog "logs/techsupport-error.log" 
    CustomLog "logs/techsupport-access.log" common 
    <Directory "e:/TechSupport"> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride All 
     Order Deny,Allow 
     Deny from all 
     Allow from 127.0.0.1 localhost ::1 
    </Directory> 
</VirtualHost> 

<VirtualHost *:8088> 
    DocumentRoot "e:/phppages" 
    ServerName phppages 
    ServerAlias www.phppages.com 
    ErrorLog "logs/phppages-error.log" 
    CustomLog "logs/phppages-access.log" common 
    <Directory "e:/PHPPages"> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride All 
     Order Deny,Allow 
     Deny from all 
     Allow from 127.0.0.1 localhost ::1 
    </Directory> 
</VirtualHost> 

Apache的错误日志显示此:

[Sun Aug 25 12:50:06.646882 2013] [mpm_winnt:notice] [pid 7936:tid 500] AH00455: Apache/2.4.4 (Win64) PHP/5.4.12 configured -- resuming normal operations 
[Sun Aug 25 12:50:06.646882 2013] [mpm_winnt:notice] [pid 7936:tid 500] AH00456: Server built: Feb 22 2013 22:08:37 
[Sun Aug 25 12:50:06.646882 2013] [core:notice] [pid 7936:tid 500] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4' 
[Sun Aug 25 12:50:06.647883 2013] [mpm_winnt:notice] [pid 7936:tid 500] AH00418: Parent: Created child process 912 
[Sun Aug 25 12:50:07.216263 2013] [mpm_winnt:notice] [pid 912:tid 384] AH00354: Child: Starting 150 worker threads. 
[Sun Aug 25 12:51:15.409867 2013] [mpm_winnt:notice] [pid 7936:tid 500] AH00422: Parent: Received shutdown signal -- Shutting down the server. 
[Sun Aug 25 12:51:17.411205 2013] [mpm_winnt:notice] [pid 912:tid 384] AH00364: Child: All worker threads have exited. 
[Sun Aug 25 12:51:17.433218 2013] [mpm_winnt:notice] [pid 7936:tid 500] AH00430: Parent: Child process 912 exited successfully. 
[Sun Aug 25 12:51:30.206760 2013] [mpm_winnt:notice] [pid 11396:tid 204] AH00455: Apache/2.4.4 (Win64) PHP/5.4.12 configured -- resuming normal operations 
[Sun Aug 25 12:51:30.207763 2013] [mpm_winnt:notice] [pid 11396:tid 204] AH00456: Server built: Feb 22 2013 22:08:37 
[Sun Aug 25 12:51:30.207763 2013] [core:notice] [pid 11396:tid 204] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4' 
[Sun Aug 25 12:51:30.208763 2013] [mpm_winnt:notice] [pid 11396:tid 204] AH00418: Parent: Created child process 4808 
[Sun Aug 25 12:51:30.670070 2013] [mpm_winnt:notice] [pid 4808:tid 384] AH00354: Child: Starting 150 worker threads. 
[Sun Aug 25 13:25:30.406049 2013] [mpm_winnt:notice] [pid 11396:tid 204] AH00422: Parent: Received shutdown signal -- Shutting down the server. 
[Sun Aug 25 13:25:32.406924 2013] [mpm_winnt:notice] [pid 4808:tid 384] AH00364: Child: All worker threads have exited. 
[Sun Aug 25 13:25:32.423935 2013] [mpm_winnt:notice] [pid 11396:tid 204] AH00430: Parent: Child process 4808 exited successfully. 
[Sun Aug 25 13:28:38.706114 2013] [mpm_winnt:notice] [pid 10328:tid 516] AH00455: Apache/2.4.4 (Win64) PHP/5.4.12 configured -- resuming normal operations 
[Sun Aug 25 13:28:38.706114 2013] [mpm_winnt:notice] [pid 10328:tid 516] AH00456: Server built: Feb 22 2013 22:08:37 
[Sun Aug 25 13:28:38.706114 2013] [core:notice] [pid 10328:tid 516] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4' 
[Sun Aug 25 13:28:38.708114 2013] [mpm_winnt:notice] [pid 10328:tid 516] AH00418: Parent: Created child process 4716 
[Sun Aug 25 13:28:39.170423 2013] [mpm_winnt:notice] [pid 4716:tid 380] AH00354: Child: Starting 150 worker threads. 
[Sun Aug 25 13:33:14.347584 2013] [mpm_winnt:notice] [pid 10328:tid 516] AH00422: Parent: Received shutdown signal -- Shutting down the server. 
[Sun Aug 25 13:33:16.349839 2013] [mpm_winnt:notice] [pid 4716:tid 380] AH00364: Child: All worker threads have exited. 
[Sun Aug 25 13:33:16.369232 2013] [mpm_winnt:notice] [pid 10328:tid 516] AH00430: Parent: Child process 4716 exited successfully. 
[Sun Aug 25 13:33:18.445939 2013] [mpm_winnt:notice] [pid 7048:tid 464] AH00455: Apache/2.4.4 (Win64) PHP/5.4.12 configured -- resuming normal operations 
[Sun Aug 25 13:33:18.445939 2013] [mpm_winnt:notice] [pid 7048:tid 464] AH00456: Server built: Feb 22 2013 22:08:37 
[Sun Aug 25 13:33:18.445939 2013] [core:notice] [pid 7048:tid 464] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4' 
[Sun Aug 25 13:33:18.446940 2013] [mpm_winnt:notice] [pid 7048:tid 464] AH00418: Parent: Created child process 2556 
[Sun Aug 25 13:33:18.801179 2013] [mpm_winnt:notice] [pid 2556:tid 324] AH00354: Child: Starting 150 worker threads. 
[Sun Aug 25 13:35:23.175992 2013] [mpm_winnt:notice] [pid 7048:tid 464] AH00422: Parent: Received shutdown signal -- Shutting down the server. 
[Sun Aug 25 13:35:25.178255 2013] [mpm_winnt:notice] [pid 2556:tid 324] AH00364: Child: All worker threads have exited. 
[Sun Aug 25 13:35:25.197268 2013] [mpm_winnt:notice] [pid 7048:tid 464] AH00430: Parent: Child process 2556 exited successfully. 
[Sun Aug 25 13:35:28.224795 2013] [mpm_winnt:notice] [pid 10616:tid 504] AH00455: Apache/2.4.4 (Win64) PHP/5.4.12 configured -- resuming normal operations 
[Sun Aug 25 13:35:28.224795 2013] [mpm_winnt:notice] [pid 10616:tid 504] AH00456: Server built: Feb 22 2013 22:08:37 
[Sun Aug 25 13:35:28.224795 2013] [core:notice] [pid 10616:tid 504] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4' 
[Sun Aug 25 13:35:28.225792 2013] [mpm_winnt:notice] [pid 10616:tid 504] AH00418: Parent: Created child process 4012 
[Sun Aug 25 13:35:28.599042 2013] [mpm_winnt:notice] [pid 4012:tid 324] AH00354: Child: Starting 150 worker threads. 
[Sun Aug 25 13:43:03.326392 2013] [mpm_winnt:notice] [pid 10616:tid 504] AH00422: Parent: Received shutdown signal -- Shutting down the server. 
[Sun Aug 25 13:43:07.389104 2013] [mpm_winnt:notice] [pid 4012:tid 324] AH00364: Child: All worker threads have exited. 
[Sun Aug 25 13:43:07.404736 2013] [mpm_winnt:notice] [pid 10616:tid 504] AH00430: Parent: Child process 4012 exited successfully. 
[Sun Aug 25 13:45:26.908312 2013] [mpm_winnt:notice] [pid 4788:tid 504] AH00455: Apache/2.4.4 (Win64) PHP/5.4.12 configured -- resuming normal operations 
[Sun Aug 25 13:45:26.970818 2013] [mpm_winnt:notice] [pid 4788:tid 504] AH00456: Server built: Feb 22 2013 22:08:37 
[Sun Aug 25 13:45:26.970818 2013] [core:notice] [pid 4788:tid 504] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4' 
[Sun Aug 25 13:45:26.970818 2013] [mpm_winnt:notice] [pid 4788:tid 504] AH00418: Parent: Created child process 5084 
[Sun Aug 25 13:45:27.517719 2013] [mpm_winnt:notice] [pid 5084:tid 384] AH00354: Child: Starting 150 worker threads. 

在的httpd.cnf文件:

Listen 0.0.0.0:8088 

(此前据只听8088)

And

Include conf/extra/httpd-vhosts.conf 

被取消注释,因为它应该是。

我现在很无奈,已经花了2天时间。请帮忙。

感谢

回答

1

我已经创建了两个VirtualHosts早期即[本地主机]和 “phpsite”。昨天我将“phpsite”改名为“phppages”,并增加了一个名为“techsupport.com”的虚拟主机。我在我的Apache服务器上使用端口8088。但是现在我可以使用[localhost]:8088和phpsite:8088,尽管没有名为“phpsite”的虚拟主机,如果我选择techsupport.com:8088,我什么也得不到。

说:“phppages”不工作和“phpsite”工作可能是因为你有“phppages” DNS项或主机文件“phpsite”的条目,而不是唯一的原因。为了调试这个,我会先开始ping它们。

ping phppages 

ping phpsite 

虽然我们在名称解析的话题,你techsupport.com:8088是行不通的,因为techsupport.com得到解决到外部网站。如果他们没有8088端口向公众开放,您将无法导航到该端口上的该站点。但是,如果他们这样做了,那么你将能够浏览他们的网页,而不是你的网页。

我不知道WAMP如何管理主机名,但首先要检查的是你的DNS服务器,如果你有一个,否则检查C:\Windows\System32\drivers\etc\hosts

为了使phppages工作如下行添加到您的C:\Windows\System32\drivers\etc\hosts

127.0.0.1 phppages www.phppages.com 

# Similarly for techsupport.com and www.techsupport.com 
127.0.0.1 techsupport.com www.techsupport.com 

在此之后您phppages与010-62529275网址应该工作。

注意:添加公用URL到您的主机文件,当/如果你从httpd-vhosts.conf删除该虚拟主机可能会导致混乱的未来,忘记删除从主机文件对应的主机名,在这种情况下,这些公用URL不会可以到达正确的目的地。所以,不建议您为虚拟主机使用公共主机名。

希望这会有所帮助。

+0

谢谢@vinod。我忘了将新的网站条目添加到C:\ Windows \ System32 \ drivers \ etc \的hosts文件中。谢谢 – DecodingLife