Apache 本地主机不工作
我花了一天时间解决这个问题,但我无法解决它 每次我尝试访问本地主机或键入127.0.0.1时,我使用的浏览器都会返回一个错误,如:“Firefox无法在www.localhost.com上找到服务器地址。”(我是法国人,我翻译了这个问题) 谷歌Chrome和127.0.0.1也出现了同样的问题。我试过XAMPP和WAMP,但还是没有。我的apachehttpd.conf看起来不错,我试图更改端口(8080、818800)。它仍然不起作用。我的Skype未在VMware工作站上打开。没有程序阻止对端口80或443的访问 我已经对localhost进行了ping测试,一切正常,但是我无法访问WAMP或XAMP的索引页 奇怪的是,我可以访问localhost/phpmyadmin和其他类似的页面 我认为我的问题出在Windows的hosts文件中,但在我看来似乎没有问题:Apache 本地主机不工作,apache,xampp,localhost,wamp,hosts,Apache,Xampp,Localhost,Wamp,Hosts,我花了一天时间解决这个问题,但我无法解决它 每次我尝试访问本地主机或键入127.0.0.1时,我使用的浏览器都会返回一个错误,如:“Firefox无法在www.localhost.com上找到服务器地址。”(我是法国人,我翻译了这个问题) 谷歌Chrome和127.0.0.1也出现了同样的问题。我试过XAMPP和WAMP,但还是没有。我的apachehttpd.conf看起来不错,我试图更改端口(8080、818800)。它仍然不起作用。我的Skype未在VMware工作站上打开。没有程序阻止对
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
::1 localhost
为什么我会想到hosts文件?因为我在XAMPP和WAMP中的vhost不起作用。也许我错了,但这个问题快把我逼疯了
谢谢你的帮助
奇怪的是,我可以访问localhost/phpmyadmin和其他
像这样的页面
听起来你的主机文件很好。有些东西阻止Apache启动并绑定到您的端口
我不太熟悉Windows,但是:
Apache启动期间的任何错误都会登录到Windows事件日志中
在Windows NT上运行时。此机制可作为这些功能的备份
Apache尚未准备好使用error.log文件的情况。
您可以使用该事件查看Windows应用程序事件日志
查看器,例如启动-设置-控制面板-管理工具-
事件查看器
看看是什么阻止Apache启动。如果您已经定义了虚拟主机,这是一个非常好的主意,那么您需要在Hosts文件中定义vhosts名称 例如,主机文件:
127.0.0.1 localhost
::1 localhost
127.0.0.1 vhost1.dev
::1 vhost1.dev
127.0.0.1 vhost2.dev
::1 vhost2.dev
否则windows无法知道在哪里查找它们
localhost不工作的另一种可能性是主机文件损坏。尝试删除它,然后使用不是记事本的编辑器重新创建它
另外,当您更改主机文件时,您需要重新启动dmscache服务“DNS客户端”,或者最好使用“以管理员身份运行”运行命令窗口并执行此操作
net stop dnscache
net start dnscache
这将激活主机文件中的新条目。我现在不知道它是否对您有帮助,这是我重新启动Apache时在日志中看到的内容
[Thu Jun 05 15:41:13.480163 2014] [mpm_winnt:notice] [pid 9984:tid 392] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Thu Jun 05 15:41:15.481278 2014] [mpm_winnt:notice] [pid 6728:tid 268] AH00364: Child: All worker threads have exited.
[Thu Jun 05 15:41:15.504279 2014] [mpm_winnt:notice] [pid 9984:tid 392] AH00430: Parent: Child process 6728 exited successfully.
[Thu Jun 05 15:41:20.536567 2014] [ssl:warn] [pid 9648:tid 392] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:20.735578 2014] [ssl:warn] [pid 9648:tid 392] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:20.757580 2014] [mpm_winnt:notice] [pid 9648:tid 392] AH00455: Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11 configured -- resuming normal operations
[Thu Jun 05 15:41:20.757580 2014] [mpm_winnt:notice] [pid 9648:tid 392] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13
[Thu Jun 05 15:41:20.757580 2014] [core:notice] [pid 9648:tid 392] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Thu Jun 05 15:41:20.758580 2014] [mpm_winnt:notice] [pid 9648:tid 392] AH00418: Parent: Created child process 3700
[Thu Jun 05 15:41:21.108600 2014] [ssl:warn] [pid 3700:tid 268] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:21.274609 2014] [ssl:warn] [pid 3700:tid 268] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:21.296610 2014] [mpm_winnt:notice] [pid 3700:tid 268] AH00354: Child: Starting 150 worker threads.
昨天,我设法摆脱了[ssl:warn][pid 3700:tid 268]AH01909,但这不是问题所在
在我的windows事件查看器中,并没有任何更改,在重新启动的同时并没有报告任何内容
注意:我已经卸载了当前的防病毒软件(我现在不建议安装),而且我的Windows防火墙似乎没有阻止与本地主机的连接。好的,我已经按照RiggsFolly告诉我的做了。我删除我的主机文件并创建一个新文件。我重新启动dmscache服务。之后,我决定为本地主机创建一个虚拟主机。在我的httpd.conf中,我检查了虚拟主机是否处于链接状态
Include conf/extra/httpd-vhosts.conf
在我的httpd-vhosts.conf中,我写道:
<Directory "/xampp/htdocs">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@das.com
DocumentRoot /xampp/htdocs/
<Directory "/xampp/htdocs/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
允许超越所有
命令允许,拒绝
通融
服务器名本地主机
服务器管理员webmaster@das.com
DocumentRoot/xampp/htdocs/
允许超越所有
命令允许,拒绝
通融
现在一切都正常了,我可以在我的主机文件中创建其他具有自定义名称的虚拟主机。主机文件将只将名称映射到IP,而不是相反。我的Apache正在运行,我已经重新安装了Xampp几次。如果我粘贴error.log可能会有所帮助?好的,我按照你说的做了,在我决定在vhosts.conf中为localhost创建一个虚拟主机之后,现在它可以工作了。我不知道它是命令行还是虚拟主机,但现在,它正在工作。非常感谢。