【问题标题】:Can not run virtual host website demo with wamp server 3.1.0无法使用 wamp server 3.1.0 运行虚拟主机网站演示
【发布时间】:2019-01-12 04:33:03
【问题描述】:

我在我的 PC 中使用 windows 10 设置 wamp 服务器。 Wamp 启动正常。我运行链接 localhost ok。

我创建了一个虚拟主机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'*

文件 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>

请帮帮我!

【问题讨论】:

  • 您应该将命令提示符文本作为文本(格式化为代码)发布,此处没有文本图像!
  • 您的配置中可能有两次Listen *:80。 Apache 每个端口只能绑定一次。或者已经有另一个可执行文件绑定相同的端口。在问题中添加您的配置,否则我们只能猜测。
  • 当您从 hdd 移动到 ssd 并安装新的 wamp 时会发生此错误。 Wamp 运行并显示绿色。您要共享配置什么?
  • httpd.conf 文件和任何Include .conf 文件。 Listen 语句在这些文件中。
  • 我刚刚更新了描述文件httpd.confhttpd-vhost.conf

标签: apache localhost wamp wampserver


【解决方案1】:

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

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

如果你放

Listen 80

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

【讨论】:

    猜你喜欢
    • 2011-05-20
    • 1970-01-01
    • 2015-01-25
    • 2015-02-26
    • 2018-02-08
    • 2016-02-23
    • 2018-04-23
    • 2011-02-01
    • 2011-09-30
    相关资源
    最近更新 更多