Apache 未运行-“拒绝连接”错误

Apache 未运行-“拒绝连接”错误

我在 Mac Yosemite 上。Apache 2.4.16。我的本地主机和本地站点停止工作。它们已经工作了几个月,直到我尝试更新/修复 MySQL。我收到以下错误:

This site can’t be reached
localhost refused to connect.
ERR_CONNECTION_REFUSED

ps aux | grep "httpd" 的结果:
3182 0.0 0.0 2432772 652 s002 S+ 8:46AM 0:00.00 grep httpd

每次我运行 ps aux | grep "httpd" 时,上面一行中的数字都会发生变化。不确定这是否是预期的。

当我运行killall -9 httpd时:
No matching processes belonging to you were found

我的主机文件:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost

127.0.0.1 test.local

httpd-vhost.conf:

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#


<VirtualHost *:80>
  DocumentRoot "/Users/<myusername>/projects/test"
  ServerName test.local
  <Directory "/Users/<myusername>/projects/test">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

我将我的实际用户名改为仅用于此帖子。

apachectl configtest 返回:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using <myusername>-iMac.local. Set the 'ServerName' directive globally to suppress this message Syntax OK

sudo launchctl print-disabled system 的结果:
disabled services = { "com.apple.AppleFileServer" => true "com.apple.hdiejectd" => false "com.apple.screensharing" => true "com.mysql.mysqld" => false "com.apple.ManagedClientAgent.enrollagent" => true "com.barebones.textwrangler" => false "com.apple.usbmuxd" => false "com.apple.odproxyd" => false "com.apple.rpmuxd" => false "com.apple.ftpd" => true "com.apple.mrt" => true "com.apple.smbd" => true "org.apache.httpd" => false "com.apple.stackshot" => false "com.apple.ManagedClient.enrollagent" => true "org.ntp.ntpd" => false "org.net-snmp.snmpd" => true "com.apple.mrt.uiagent" => false "org.macosforge.xquartz.privileged_startx" => false "com.apple.pacemaker" => true "com.apple.flashupdater" => false }

答案1

该 grep 行表示进程列表中对搜索字符串的唯一引用是执行搜索的进程。因此它没有运行。使用 launchd 重新启动它。

相关内容