nginx - Vagrant 转发端口 8080 到 80

标签 nginx vagrant

所以我有一个 NGINX 服务器在 Vagrant box 上使用 uwsgi 监听端口 8080。 config.vm.forward_port 8080, 80 对我不起作用。我知道建议在高于 2000 的端口上转发,但我需要 80。这有什么问题吗?

我正在使用 vagrant 进行开发,但我需要在端口 80 上使用我的域名从外部进行一些测试。 感谢您的帮助。

最佳答案

当尝试将端口转发到小于 1025 时,vagrant 会给我以下您可能错过的消息:

You are trying to forward to privileged ports (ports <= 1024). Most operating systems restrict this to only privileged process (typically processes running as an administrative user). This is a warning in case the port forwarding doesn't work. If any problems occur, please try a port higher than 1024.

我使用端口转发到具有以下配置的相同端口:

config.vm.forward_port 80, 80

然后运行 ​​vagrant up,但是当尝试 curl localhost 时,它无法连接到主机。但是当以 sudo 用户身份运行 vagrant sudo vagrant up 时,我就能够从我的主机访问该端口。

关于nginx - Vagrant 转发端口 8080 到 80,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11342085/

相关文章:

node.js - 无法加载资源: the server responded with a status of 504 (Timeout while reading response from Server) Node. js,Nginx

django - 将 SSL 与 Gunicorn/Django/Nginx 应用程序一起使用时出现混合内容错误

无论 NGINX 状态码如何,PHP-FPM 始终返回 200

c - 使用 ?_escaped_fragment_= 向 Google 机器人提供 index.html

vagrant - Packer 使用默认变量?

Vagrant up - 以下设置不应该存在 : vm (rethinkdb-vagrant)

redirect - 使用 ssl 的 nginx 重定向循环

terminal - 尝试启动 Virtual Box 时如何修复这些错误?

vagrant - 无法在 Vagrant 中同步主目录

python - 如何响应 os.system 中的提示?