Setting up the Webrick to serve to internet my rails app

大城市里の小女人 提交于 2019-12-23 04:36:21

问题


I try to host my ruby on rails app in my computer in Ubuntu but I cannot get it. I try to port forward from my router settings. I think I successfully forward the ports a source ports 80 - 8080 and destination port 3000. Then I start webrick in production mode. However, I could not open my app from internet by typing my external IP. How can I set my computer in proper way? Do you have any suggestions?

Thanks...


回答1:


Try the following to help debug the issue:

  1. From the same machine (you can use curl in place of wget if you'd like, as it's more powerful), make sure rails is running

    $ wget http://localhost:3000

  2. From the same machine, make sure the server is bound to an external ip address

    $ ifconfig (lists the ip address a.b.c.d)

    $ wget http://a.b.c.d:3000

  3. From another machine on the same network, make sure you request the web page

    $ wget http://a.b.c.d:3000

If the first step fails, rails might not be running. If the second step fails, then you might have an issue with how networking is setup, but you can try rails server -b a.b.c.d to see if that fixes it. If the last step fails, then you have an issue with your local network. Finally, if they all succeed, then the issue is either with your ISP or with your router.



来源:https://stackoverflow.com/questions/10220621/setting-up-the-webrick-to-serve-to-internet-my-rails-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!