【发布时间】:2017-01-14 19:31:27
【问题描述】:
当尝试访问我的本地主机上的站点时,连接被拒绝。两天前,该设置在配置多个虚拟主机时没有问题。我不知道任何可能影响设置的更改。我昨天花了一整天试图解决这个问题,但一直在绕圈子。
操作系统:OSX 10.11.16
httpd -V 返回:
Server version: Apache/2.4.18 (Unix)
Server built: Feb 20 2016 20:03:19
Server's Module Magic Number: 20120211:52
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_FLOCK_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/usr"
-D SUEXEC_BIN="/usr/bin/suexec"
-D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
httpd.conf 被配置为允许虚拟主机,并且 httpd-vhosts.conf 文件中没有任何变化。
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
...
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
apachectl configtest 返回:
Syntax OK
我已尝试对 127.0.0.1 运行端口扫描,但 http 端口 80 不显示。这和被拒绝的连接让我认为这是问题所在,但我不知道为什么。 OSX 防火墙已关闭。 I've tried the solution posted here 但它没有修复它。
我的 /etc/hosts 文件如下所示:
#
# 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 site.local
127.0.0.1 othersite.local
...
我可以 ping 127.0.0.1。我以前安装了 homebrew 来运行不同的 PHP 版本,但我已经删除了它以尝试将系统恢复到库存。我真的不知道接下来要尝试什么,任何帮助将不胜感激。
【问题讨论】:
-
sudo apachectl start可能吗? -
@MarkSetchell 在过去的两天里,我一直在不断地重新启动 apachectl,但没有任何运气。我知道它会在启动时自动启动,而我并没有停止它。尽管如此,当我尝试它时,我得到了
/System/Library/LaunchDaemons/org.apache.httpd.plist: service already loaded,我认为这意味着它已经开始了? -
确定你的配置已经配置了80端口?
-
@P.J.Meisch 我在哪里可以检查?
-
用于
/private/etc/apache2/extra/httpd-vhosts.conffile 中的vhosts,默认是定义/private/etc/apache2/httpd.conf'. Look for theListen`directive