onk*_*ows 5 vagrant vagrantfile
我有一个JBoss的Vagrant盒子.我正试图转发两个端口.我Vagrantfile有以下内容
web.vm.network "forwarded_port", guest: 8080, host: 8080 # jboss
web.vm.network "forwarded_port", guest: 9990, host: 9990 # jboss management console
Run Code Online (Sandbox Code Playgroud)
在vagrant up web我可以在控制台中看到
==> web: Forwarding ports...
web: 8080 => 8080 (adapter 1)
web: 9990 => 9990 (adapter 1)
Run Code Online (Sandbox Code Playgroud)
当我做netstat端口似乎没问题
$ sudo netstat -tulpn | grep VirtualBox
[sudo] password for ostraaten:
tcp 0 0 0.0.0.0:9990 0.0.0.0:* LISTEN 21241/VirtualBox
tcp 0 0 127.0.0.1:2222 0.0.0.0:* LISTEN 21241/VirtualBox
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 21241/VirtualBox
Run Code Online (Sandbox Code Playgroud)
当我curl -v http://localhost:8080在Vagrant盒子上做的时候,这很好用.我看到了JBoss的东西.
当我curl -v https://localhost:8080在主机上做其他事情时.
$ curl -v http://localhost:8080
* Rebuilt URL to: http://localhost:8080/
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8080
> Accept: */*
>
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
Run Code Online (Sandbox Code Playgroud)
Vagrant框上没有运行防火墙.
首先,转发端口的配置似乎微不足道,但现在看起来还有更多.这怎么办?
我知道这有点太晚了,但我刚刚遇到了类似的问题,但我正在使用 Sinatra。经过一番研究,正如 Al Jacinto 所说,我发现像这样运行你的 ruby 应用程序:
ruby app.rb -o 0.0.0.0
Run Code Online (Sandbox Code Playgroud)
(http://www.sinatrarb.com/intro.html)
应该解决问题,而不需要编辑 ruby.rb 如果这不相关,我深表歉意,但我认为它可能会给出一个提示!
| 归档时间: |
|
| 查看次数: |
2511 次 |
| 最近记录: |