- 服务器在具有 Vagrant 的 VM 中运行:
vagrant@ubuntu-xenial:/vagrant/email_api$ python3 emailapi.py瓶子 v0.12.17 服务器启动(使用 WSGIRefServer(((...收听 http://127.0.0.1:8080/按 Ctrl-C 退出。
但是当我使用 IP 访问 API 时,我得到:
无法得到任何响应连接到 时出错。为什么会发生这种情况:-服务器无法发送响应:确保后端正常工作- 自签名 SSL 证书被阻止:通过在"常规设置"中关闭"SSL 证书验证"来解决此问题>-代理配置不正确确保在"代理设置"中正确配置了代理>-请求超时: "常规设置"中的更改请求超时>
*流浪者档案 :
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct:
true
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.network "public_network"
您应该在0.0.0.0
上运行您的瓶子应用程序以将其导出到"其他"机器
app.run(host="0.0.0.0", port=80, reloader=True, debug=True) # ...
<</div>
div class="one_answers">对我来说,我代理通过 nginx 的内部服务器运行良好,只需在 nginx 上进行这样的配置
server{
listen 85;
listen [::]:85;
server_name rsshistory.com;
location / {
proxy_pass http://127.0.0.1:8000/;
}
}
在流浪者文件上,不要打开所有这些,只是这样做
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.$
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.11"
现在您可以访问瓶子服务器 true 192.168.33.11:85