解决MacOS上的localhost / apache -连接被拒绝错误

fcg9iug3  于 2022-11-16  发布在  Apache
关注(0)|答案(1)|浏览(1319)

我正在尝试调试localhost连接被拒绝错误。对于上下文,我有一个Flask应用程序,我正在尝试在本地运行。我使用gunicorn启动该应用程序,并注意到它正在端口8000上运行。

Starting gunicorn 20.1.0
[2022-02-24 05:38:49 -0800] [21269] [INFO] Listening at: http://127.0.0.1:8000 (21269)
[2022-02-24 05:38:49 -0800] [21269] [INFO] Using worker: sync
[2022-02-24 05:38:49 -0800] [21271] [INFO] Booting worker with pid: 21271

我已经尝试了几种方法,包括:
1.重新启动apache服务器-sudo apachectl restart
1.刷新dns:sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache
1.运行httpd

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using MacBook-Air-2020.local. Set the 'ServerName' directive globally to suppress this message
    (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
  1. telnet 127.0.0.1
Trying 127.0.0.1...
    telnet: connect to address 127.0.0.1: Connection refused
    telnet: Unable to connect to remote host

1.当我在浏览器中输入http://127.0.0.1/时,
真管用!
我还可以尝试什么?我正在使用gunicorn服务器在本地部署/运行应用程序。

ipakzgxi

ipakzgxi1#

这对我来说很有用:

sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache

相关问题