排除 MacOS 上的 localhost/apache - 连接被拒绝错误
我正在尝试调试 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
我尝试了几件事,包括:
- 重新启动 apache 服务器 -
sudo apachectl restart
- 刷新 dns:
sudo Killall -HUP mDNSResponder;sudo Killall mDNSResponderHelper;sudo dscacheutil -flushcache
- 运行
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
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
- 当我在浏览器中输入
http://127.0.0.1/
时,我得到
It Works!
我还能尝试什么?我正在使用 gunicorn
服务器在本地部署/运行应用程序。
I am trying to debug localhost
connection refused error. For context, I have a Flask App that I am trying to run locally. I launch the app using gunicorn
and notice that it is running on port 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
I have tried several things including:
- restart apache server -
sudo apachectl restart
- flush dns:
sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache
- Run
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
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
- When I enter
http://127.0.0.1/
in browser, I get
It works!
What else can I try? I am using gunicorn
server to deploy / run the App locally.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对我来说很有效:
This did the trick for me: