2013-08-25 38 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