将我的 macOS 升级到 Monterey 后,我无法启动 apache。当我运行命令时sudo brew services start httpd
,httpd 看起来像已启动:
Warning: Taking root:admin ownership of some httpd paths:
/usr/local/Cellar/httpd/2.4.54_1/bin
/usr/local/Cellar/httpd/2.4.54_1/bin/httpd
/usr/local/opt/httpd
/usr/local/opt/httpd/bin
/usr/local/var/homebrew/linked/httpd
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
Warning: httpd must be run as non-root to start at user login!
==> Successfully started `httpd` (label: homebrew.mxcl.httpd)
但是,当我列出时brew services
,httpd 的状态显示错误
Name Status User File
dnsmasq none root
httpd error 256 root ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
mariadb started username ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
php started username ~/Library/LaunchAgents/homebrew.mxcl.php.plist
/usr/local/var/log/httpd
error_log显示:
[Sun Oct 16 16:24:04.427782 2022] [mpm_prefork:notice] [pid 124] AH00163: Apache/2.4.54 (Unix) configured -- resuming normal operations
[Sun Oct 16 16:24:04.440562 2022] [core:notice] [pid 124] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
[Sun Oct 16 16:27:19.886482 2022] [mpm_prefork:notice] [pid 124] AH00169: caught SIGTERM, shutting down
[Sun Oct 16 16:27:21.002159 2022] [mpm_prefork:notice] [pid 2256] AH00163: Apache/2.4.54 (Unix) configured -- resuming normal operations
[Sun Oct 16 16:27:21.002486 2022] [core:notice] [pid 2256] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
ps aux | grep -I httpd
显示:
username 4981 0,0 0,0 34150780 976 ?? S 4:34PM 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
username 4980 0,0 0,0 34156924 972 ?? S 4:34PM 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
username 4978 0,0 0,0 34166140 968 ?? S 4:34PM 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
username 4977 0,0 0,0 34155900 960 ?? S 4:34PM 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
username 4931 0,0 0,0 34145800 2860 ?? Ss 4:34PM 0:00.03 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
username 5394 0,0 0,0 34122868 852 s000 R+ 4:40PM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox -i httpd
username 4982 0,0 0,0 34156924 948 ?? S 4:34PM 0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
which -a apachectl
命令显示一些重复的值:
/usr/local/bin/apachectl
/usr/local/bin/apachectl
/usr/sbin/apachectl
/usr/local/bin/apachectl
和之间似乎存在一些冲突/usr/local/opt/httpd/bin/httpd
。卸载 brew httpd 并手动删除其文件夹不起作用。我该如何解决这个问题?