无法使用Wamp Server 3.1.0运行虚拟主机网站演示

时间:2018-08-04 15:10:34

标签: apache localhost wamp wampserver

我在PC上使用Windows 10设置了Wamp服务器。 沼泽开始好了。我运行链接本地主机就可以了。

我成功创建了一个虚拟主机abcd.test,但无法运行。

我检查了apache_error日志:

[Sat Aug 04 21:52:05.462895 2018] [mpm_winnt:notice] [pid 13960:tid 628] AH00422: Parent: Received shutdown signal -- Shutting down the server. 
[Sat Aug 04 21:52:07.465001 2018] [mpm_winnt:notice] [pid 12684:tid 700] AH00364: Child: All worker threads have exited. 
[Sat Aug 04 21:52:07.489996 2018] [mpm_winnt:notice] [pid 13960:tid 628] AH00430: Parent: Child process 12684 exited successfully. 
[Sat Aug 04 21:52:08.278895 2018] [mpm_winnt:notice] [pid 16620:tid 752] AH00455: Apache/2.4.27 (Win64) PHP/5.6.31 configured -- resuming normal operations 
[Sat Aug 04 21:52:08.278895 2018] [mpm_winnt:notice] [pid 16620:tid 752] AH00456: Apache Lounge VC15 Server built: Jul  7 2017 12:46:00 
[Sat Aug 04 21:52:08.278895 2018] [core:notice] [pid 16620:tid 752] AH00094: Command line: 'D:\\wamp64\\bin\\apache\\apache2.4.27\\bin\\httpd.exe -d D:/wamp64/bin/apache/apache2.4.27' 
[Sat Aug 04 21:52:08.282891 2018] [mpm_winnt:notice] [pid 16620:tid 752] AH00418: Parent: Created child process 17360 
[Sat Aug 04 21:52:08.564039 2018] [mpm_winnt:notice] [pid 17360:tid 728] AH00354: Child: Starting 64 worker threads.

我运行cmd命令行:

'D:\\wamp64\\bin\\apache\\apache2.4.27\\bin\\httpd.exe -d D:/wamp64/bin/apache/apache2.4.27'*

enter image description here

文件httpd:

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80
...

文件虚拟主机:

# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>


<VirtualHost *:80>
    ServerName wordpress.test
    DocumentRoot "d:/projects/wordpress"
    <Directory  "d:/projects/wordpress/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

请帮助我!

1 个答案:

答案 0 :(得分:0)

问题出在您的Listen语句上。 1个端口只能有1个Listen

第一个告诉Apache绑定端口80,第二个告诉它同一件事,因此发生冲突。参见https://httpd.apache.org/docs/2.4/bind.html

如果你放

Listen 80

它将在所有接口上绑定端口80 ,因此无需为IPv4指定一次,而为IPv6指定一次。它将自动处理这两个问题。