AWS第一台服务器访问第二台服务器上的文件 [英] AWS first server access files on second server

查看:48
本文介绍了AWS第一台服务器访问第二台服务器上的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个AWS ubuntu 16.04 nodejs EC2实例.我有2个基本的Express服务器在不同的端口上运行.我想在第一台服务器中的html中访问第二台服务器上的文件.这个命令在我的头文件中:

I am running an AWS ubuntu 16.04 nodejs EC2 instance. I have 2 basic express servers running on different ports. I want to access files on the second server in an html in my first server. This command in my header:

<script type="text/javascript" src="//localhost:84/test.js"></script>

由于某种原因无法正常工作.我已经将test.js文件放在每个可能的位置.我在做什么错了?

doesn’t work for some reason. I have put the test.js file in every conceivable spot. What am I doing wrong?

这是我以前的stackoverflow帖子,我基本上只是改写为:

This is my previous stackoverflow post that I’ve basically just reworded:

在第二台本地服务器上访问js文件

这是我最初在easyrtc论坛上最初尝试在流星上做同样的事情时的帖子:

This is my original post on the easyrtc forum when I initially tried to do the same thing in meteor:

https://groups.google.com/forum/?fromgroups#!topic/easyrtc/Mx48JcSpGwE

这是我最终想要做的事情的参考:

This is the reference of what I’m trying to eventually do:

https://easyrtc.com/docs/easyrtc_with_other_servers.php

推荐答案

您从问题中遗漏了一些内容,但我会猜测发生了什么.

You're missing a few items from your question, but I'll take a guess as to what's happening.

您正在通过浏览器从某个服务器获取原始请求.返回的HTML包含您上面的问题中的javascript链接.

You're getting your original request from some server via a browser. The HTML that is returned includes the javascript link you have in your question above.

此时, http://localhost/是运行浏览器的计算机,而不是同一台服务器原始内容来自.因此,您将需要用服务器的名称或IP地址替换本地主机.

At this point, http://localhost/ is the machine the browser is running on, NOT the same server the original content came from. So you will need to replace the localhost with the name or IP address of the server.

您还必须确保与EC2实例关联的安全组之一具有除端口80外还允许端口84的规则.

You'll also have to make sure that one of the security groups associated with the EC2 instance has a rule to allow port 84 in addition to port 80.

这篇关于AWS第一台服务器访问第二台服务器上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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