apache - 无法使用 wamp server 3.1.0 运行虚拟主机网站演示
问题描述
我在我的 PC 中使用 Windows 10 设置了 wamp 服务器。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'*
文件 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
陈述。您只能有 1Listen
对 1 端口。
第一个告诉 Apache 绑定端口 80,第二个告诉它同样的事情,因此冲突。见https://httpd.apache.org/docs/2.4/bind.html
如果你把
Listen 80
它将在所有接口上绑定端口 80 ,因此无需为 IPv4 指定一次,为 IPv6 指定一次。它会自动处理两者。
推荐阅读
- java - 如何使用 String.format() 在 Java 中格式化双精度
- inheritance - XSLT 属性集依赖性报告/查询
- c# - WebView 和错误管理,有什么问题?
- javascript - 如何将 json 数据从 d3.js 发送到烧瓶服务器?
- asterisk - Stasis 应用程序未激活 - 拨打分机时出现星号错误
- c++ - 多维数组逻辑
- typescript - Typescript:未绑定类型依赖于另一个泛型的泛型类
- javascript - Reactjs - 向减速器发送调度问题?
- azure-cosmosdb - 在 Azure Powershell 中使用 Add-AzMetricAlertRuleV2 时在哪里可以找到条件值?
- angular - 错误类型错误:无法读取未定义的属性“sortChange”,显示此错误?