![](/img/trans.png)
[英]OS X Vagrant host unable to connect to Apache/Passenger Server on Redirect
[英]rails 2.3 server running inside vagrant environment not accessible in host machine mac os x browsers
在流浪我使用:
框'prorail/centos-5.8-x86_64'
在 vagrant 中,我正在運行 Rails 2.3 服務器,例如:
[vagrant@localhost myapp]$ script/server
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
在我的主機文件中,我在底部添加了這一行
192.168.60.110 www.example.dev example.dev dev.example.com
在 Vagrantfile 中,我添加了這個 ip:
config.vm.network :private_network, ip: "192.168.60.110"
在所有瀏覽器中,我都嘗試過以下網址
dev.example.com:3000/
dev.example.com
在瀏覽器中什么也沒有發生。 我已經嘗試了所有瀏覽器
chrome
tor
firefox
safari
我已經嘗試了其他幾個命令來在 vagrant 環境中運行 rails 2.3 服務器,但仍然沒有任何反應
script/server -b 0.0.0.0
script/server -b 0.0.0.0 -p 3000
script/server -p 3000
登錄 vagrant 環境:
vagrant ssh
而不是鍵入或復制/粘貼以下命令:
sudo /sbin/iptables -I INPUT -p tcp --dport 3000 -j ACCEPT
此命令將允許主機訪問端口。 比類型:
exit
再次登錄 vagrant 並轉到您的項目根目錄。 比運行:
script/server
現在您可以在瀏覽器中訪問它
www.example.dev
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.