如何连接到EC2上的一个网络服务器“私人” [英] How to connect to a webserver on ec2 'privately'

查看:189
本文介绍了如何连接到EC2上的一个网络服务器“私人”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有部署在EC2实例一点点的Web应用程序,我想不使其公开可用来测试它。

I have a little web application deployed on an ec2 instance and I'd like to test it without making it publicly available.

使用弹性IP并没有解决我的问题,因为IP然后将其暴露于外部世界,我们都没有为此做好准备呢。

Using an elastic IP does not solve my issue because the IP would then expose it to the outside world and we are not ready for this yet.

我知道亚马逊VPC,但它似乎有点矫枉过正,因为我并不需要所有这些功能,我不想对付成立。所有我需要的是能够通过使用专用IP之类的东西打网络服务器。

I'm aware of Amazon VPC but it seems a bit overkill since I don't need all those functionalities and I don't want to deal with the set up. All I need is to be able to hit the webserver by using a private IP or something like that.

有一个快速和肮脏的解决方案呢?

Is there a quick and dirty solution for this?

推荐答案

您可以设置您的Web服务器只监听127.0.0.1(而不是0.0.0.0),然后使用SSH隧道从本地机器的连接实例

You could setup your web server to listen only on 127.0.0.1 (rather than 0.0.0.0) and then use SSH to tunnel a connection from your local machine to the instance.

从桌面设置SSH连接:

From your desktop, setup the SSH connection:

$ ssh -L 3000:localhost:80 ec2-user@ec2-instance.amazonaws.com

接着参观的http://本地主机:3000在你的浏览器,它会转发端口3000您的桌面上的实例80端口,通过SSH连接

这篇关于如何连接到EC2上的一个网络服务器“私人”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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