我正在使用Vagrant和Ansible在我的Centos7虚拟机上部署一个应用程序。我可以通过localhost:8080和localhost8000连接到虚拟机上的应用程序。如何使用端口转发来访问我主机上的应用程序(例如我在我的主机上打开我的web浏览器,我可以通过localhost:8080和localhost:8000访问应用程序?
发布于 2019-11-13 05:01:13
您可以使用:
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.network "forwarded_port", guest: 8000, host: 8000
end有关更多信息,请参阅:https://www.vagrantup.com/docs/networking/forwarded_ports.html
在那之后,如果你遇到任何问题。请让我知道。
https://stackoverflow.com/questions/58826426
复制相似问题