Apache/Nginx 在 macOS Sierra 上卸载 laravel/valet 和 homestead 后的配置问题
Apache/Nginx configuration issue after uninstalling laravel/valet and homestead on macOS Sierra
在 macOS Sierra 上卸载 laravel/valet 和 Homestead 后,我切换回 Apache(而不是 NGINX),尝试使用 sudo apachectl -k restart
重新启动它,但它输出了这个错误:
httpd not running, trying to start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
附加信息 - 使用带有 OS Sierra 10.12.6 的 Homebrew 1.3.1。还使用了与此处找到的类似的本地环境:
https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
免责声明: 我几乎从不使用 NGINX 但我假设它,或者 laravel/valet 设置中涉及的其他东西阻止 Apache绑定到正确的端口。
如何修复此错误并重新配置 Apache 以再次使用 Homebrew,而不是 NGINX?
lsof -i | grep LISTEN | grep ":80"
没有输出,但 sudo lsof -i :80
的输出如下:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 12146 root 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 12148 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37113 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37114 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37115 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 38654 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
首先检查nginx是不是运行
ps aux | grep nginx
如果是 运行 然后使用 brew
检查它是否是 运行
brew services list
如果显示 nginx 已启动,那么您可以使用以下命令停止它
brew services stop nginx
如果它没有被列为已启动或没有被列为服务,那么尝试手动终止 nginx
pkill nginx
现在尝试重新启动 apache
sudo apachectl restart
在 macOS Sierra 上卸载 laravel/valet 和 Homestead 后,我切换回 Apache(而不是 NGINX),尝试使用 sudo apachectl -k restart
重新启动它,但它输出了这个错误:
httpd not running, trying to start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
附加信息 - 使用带有 OS Sierra 10.12.6 的 Homebrew 1.3.1。还使用了与此处找到的类似的本地环境: https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
免责声明: 我几乎从不使用 NGINX 但我假设它,或者 laravel/valet 设置中涉及的其他东西阻止 Apache绑定到正确的端口。
如何修复此错误并重新配置 Apache 以再次使用 Homebrew,而不是 NGINX?
lsof -i | grep LISTEN | grep ":80"
没有输出,但 sudo lsof -i :80
的输出如下:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 12146 root 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 12148 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37113 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37114 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37115 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 38654 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
首先检查nginx是不是运行
ps aux | grep nginx
如果是 运行 然后使用 brew
检查它是否是 运行brew services list
如果显示 nginx 已启动,那么您可以使用以下命令停止它
brew services stop nginx
如果它没有被列为已启动或没有被列为服务,那么尝试手动终止 nginx
pkill nginx
现在尝试重新启动 apache
sudo apachectl restart