允许其他人通过亚马逊实例查看您的Sinatra本地服务器 [英] allow others to see your Sinatra local server through amazon instance

查看:88
本文介绍了允许其他人通过亚马逊实例查看您的Sinatra本地服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

真的很难解释。但基本上,我有一个Amazon实例,我想ssh到其中并使用sinatra在其上运行本地服务器。所以我将ssh进入亚马逊实例,git克隆我的仓库,并运行ruby config.ru。然后,我希望其他人能够看到正在运行的确切本地服务器。我要做的一件事是添加了一个安全组,即HTTP端口4567,以便我可以通过公共DNS对其进行访问。它可以在机架式应用程序上运行,但不能在sinatra上运行,我什至尝试使用 hello world示例应用程序来使其正常运行。

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.

推荐答案

我不确定是否有特定原因要从Amazon服务器执行此操作,但是如果您只希望其他人看到您的sinatra应用程序,则只需使用 localtunnel

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.

使用此命令,您可以简单地在OWN计算机上运行localhost,然后运行 localtunnel PORTNUMBER ,它将为您提供一个URL,您的应用程序将现在可见。然后,您可以将该URL提供给任何您想要的人。

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.

使用示例:

$ ruby​​ myapp.rb

$ localtunnel 4567

然后将显示一个URL,供您复制粘贴到朋友。如此简单。

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

我在开发Web应用程序以使其移动友好时经常使用此功能,并且希望快速查看手机上的应用程序而不必部署到服务器上

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.

这篇关于允许其他人通过亚马逊实例查看您的Sinatra本地服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆