Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache正在运行,但我不知道';从我的网络浏览器上看不到任何迹象_Apache_Virtualhost_Host - Fatal编程技术网

Apache正在运行,但我不知道';从我的网络浏览器上看不到任何迹象

Apache正在运行,但我不知道';从我的网络浏览器上看不到任何迹象,apache,virtualhost,host,Apache,Virtualhost,Host,我在MacOsX 10.9.3上,我的apache正在运行: $ sudo apachectl start org.apache.httpd: Already loaded Apache正在运行,在我的/etc/hosts中,我有: 127.0.0.1 qwertyuiopoiuytrewq.mnbvcxzxcvbnm.com 我可以ping qwertyuiopoiuytrewq.mnbvcxzxcvnm.com,但无法从浏览器中查看 http://qwertyuiopoiuytrewq.

我在MacOsX 10.9.3上,我的apache正在运行:

$ sudo apachectl start
org.apache.httpd: Already loaded
Apache正在运行,在我的/etc/hosts中,我有:

127.0.0.1 qwertyuiopoiuytrewq.mnbvcxzxcvbnm.com
我可以ping qwertyuiopoiuytrewq.mnbvcxzxcvnm.com,但无法从浏览器中查看

http://qwertyuiopoiuytrewq.mnbvcxzxcvbnm.com/
这是我的虚拟主机:

NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot /path/to/root
    ServerName qwertyuiopoiuytrewq.mnbvcxzxcvbnm.com
    ServerAlias qwertyuiopoiuytrewq.mnbvcxzxcvbnm.com
</VirtualHost>
怎么了?可能是Apache正在侦听的端口?如何检查apache服务使用的端口

$ lsof -i | grep apache
什么也没反应。。。我试过用一位同事建议的命令

$ lsof -i :80
但是

COMMAND     PID          USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Google    13069 simonegentili   84u  IPv4 0xec5b6b421454cd89      0t0  TCP     192.168.11.46:52061->fa-in-f95.1e100.net:http (ESTABLISHED)
Google    13069 simonegentili  105u  IPv4 0xec5b6b421304ed89      0t0  TCP 192.168.11.46:52100->mil02s05-in-f13.1e100.net:http (ESTABLISHED)
Google    13069 simonegentili  125u  IPv4 0xec5b6b42172fe5a1      0t0  TCP 192.168.11.46:51372->mil01s16-in-f1.1e100.net:http (ESTABLISHED)
Google    13069 simonegentili  138u  IPv4 0xec5b6b42145a7d89      0t0  TCP 192.168.11.46:52070->edge-star-shv-07-fra3.facebook.com:http (ESTABLISHED)
我已尝试检查apache正在侦听哪个端口:

$ cat /etc/apache2/httpd.conf | grep Listen
Apache应该响应80端口

# Listen: Allows you to bind Apache to specific IP addresses and/or
# Change this to Listen on specific IP addresses as shown below to
#Listen 12.34.56.78:80
Listen 80

例如,我不明白这个答案:

$ sudo apachectl start
org.apache.httpd: Already loaded
$ ps aux | grep httpd
simonegentili   26677   0.0  0.0  2444976    416 s001  U+    6:13PM   0:00.00 grep httpd

ping测试主机是否可以通过网络访问,并且通常由内核处理,而不是由运行在上面的任何软件处理。ping已经验证了主机是否存在,这与Apache在端口上侦听无关


您必须使用此命令启动apache服务
/etc/init.d/apache2
start,127.0.0.1只是一个环回网络接口。

显然,当您破坏httpd.conf时,可能会发生这种情况。服务管理器没有报告带有行号的正常apache配置解析错误,而是误导了您

见:

检查正在运行的进程时,我注意到apache实际上并不是 跑步,这似乎有点奇怪。幸运的是,apachectl提供了一个 用于检查配置语法的有用命令,apachectl configtest。 果然,我修改了httpd.conf好几年了 几周前,但从未重新启动Apache。评出冒犯者 线路和启动Apache修复了问题,我现在就回来 跑步


所以,至少你只需要调试一个正常的httpd.conf错误,而不是这个谜。

我已经修改了这个问题。所有浏览器都没有响应。apache何时运行,何时不运行。是否有任何httpd进程实际运行?您的apachectl似乎有一些供应商定制,以使用一些备用服务设施(上游工具不报告org.apache.httpd:“错误日志的底部通常也非常有用。更新了我的答案。我认为“apache已打开,但我不确定。您能否阅读我问题的底部以了解原因。您的问题似乎与系统上的服务控制有关,因为输出中只有“grep”命令本身。非常感谢!”apachectl configtest告诉我配置错误的地方。已修复。但是,…为什么任何错误都会向我显示这些内容?我的意思是,…任何apache错误!!神秘。
$ sudo apachectl start
org.apache.httpd: Already loaded
$ ps aux | grep httpd
simonegentili   26677   0.0  0.0  2444976    416 s001  U+    6:13PM   0:00.00 grep httpd