allow others to see your Sinatra local server through amazon instance

安稳与你 提交于 2019-12-11 09:38:27

问题


It's really difficult to explain. But basically, I have an amazon instance, and I want to ssh into it and run a local server on it with sinatra. so I would ssh into the amazon instance, git clone my repo, and run ruby config.ru. Then I want someone else to be able to see that exact local server that is being ran. One of the things I've done is added a security group, port 4567 HTTP so that I can access it via public dns. It works on a rack app but it doesn't work on the sinatra, I've even tried a 'hello world' sample app to try to get it working.


回答1:


I'm not sure if there is a specific reason that you want to do this from an Amazon server or not, but if you just want someone else to see your sinatra app, you could simply use localtunnel.

Using this, you can simply run localhost on your OWN computer, then run localtunnel PORTNUMBER and it will give you a URL that your app will now be visible from. You can then give that URL to anyone you want.

Example of use:

$ ruby myapp.rb

$ localtunnel 4567

A URL will then be displayed for you to copy-paste to a friend. Easy as that.

I use this a lot when developing web apps to be mobile friendly and want to quickly look at the app on my phone without having to deploy to a server.



来源:https://stackoverflow.com/questions/17536355/allow-others-to-see-your-sinatra-local-server-through-amazon-instance

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