简体   繁体   English

如何使对“ api.mydomain.com:8000”的请求重定向到EC2实例的IP

[英]How I can make that the request to 'api.mydomain.com:8000' redirect to IP for the EC2 instance

I have an api running in a EC2 instance in AWS in certain port (ej 8000). 我有一个在特定端口(ej 8000)的AWS的EC2实例中运行的api。 I have register a domain in bluehost provider. 我已经在bluehost提供程序中注册了一个域。

Currently my app is pointing to the IP that offer the EC2 instance, but I want to change to the domain in order to use like api.mydomain.com:8000. 目前,我的应用指向的是提供EC2实例的IP,但我想更改为域,以便像api.mydomain.com:8000这样使用。

I tried to create a configuration in the DNS zone of panel control in the bluehost account, but it does not work, I think the DNS type I have to use is the 'SRV record', but I tried some configuration but the cpanel dont take it. 我试图在bluehost帐户中的面板控件的DNS区域中创建配置,但是它不起作用,我认为我必须使用的DNS类型是“ SRV记录”,但是我尝试了一些配置,但是cpanel不接受它。

How I can make that the request to 'api.mydomain.com:8000' redirect to the EC2 instance's IP and the configurated port?. 如何使对“ api.mydomain.com:8000”的请求重定向到EC2实例的IP和配置的端口? Thank you 谢谢

通常,您将创建“ A”记录以将域名指向IP地址,而不是“ SRV”记录。

You can use a normal A record for api.mydomain.com and point that to your instances IP address. 您可以对api.mydomain.com使用普通的A记录,并将其指向您的实例IP地址。 You don't include the port anywhere in the DNS configuration. 您不会在DNS配置中的任何位置包含该端口。

If it was a website that was on port 8000 you would type api.mydomain.com:8000 in your browser url. 如果它是端口8000上的网站,则应在浏览器URL中键入api.mydomain.com:8000。

Make sure that your instances security group is open on port 8000, and that your instance is listening on port 8000. 确保实例安全组在端口8000上打开,并且实例在端口8000上侦听。

When you say "it didn't work", what do you mean? 当您说“它不起作用”时,您是什么意思? Where was there a failure? 哪里有故障?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Domain + AWS EC2:如何让www.mydomain.com指向我的EC2服务器? - Domain + AWS EC2: How to make www.mydomain.com point to my EC2 server? 如何在API网关中使用EC2 IP地址? - How can I use an EC2 ip address in API Gateway? 如何才能使API网关仅用于我的ec2实例? - How can I make API gateway only available to my ec2 instance? Rails和EC2 API-如何监视EC2实例状态并在“运行”时触发方法? - Rails & EC2 API - how can I monitor an EC2 instance status and trigger a method on 'running'? 如何从EC2实例重定向到我的IP - How to redirect to my ip from ec2 instance 如何在EC2启动实例请求中获取公共IP地址? - How to obtain the Public IP Address on EC2 launch instance request? 如何配置运行 DPDK 的 EC2 实例以过滤弹性 IP 和另一个 ec2 实例之间的流量? - How can I configure my EC2 instance running DPDK to filter traffic between elastic IP and another ec2 instance? 我可以为我的EC2实例而不是IP设置网址吗? - Can I set a url to my EC2 instance instead of the IP? 通过AWS API创建新的EC2实例,如何获得公共IP - From AWS API creating a new EC2 instance, how do I get a public ip EC2 实例如何访问 Internet IP 以与 EC2 实例所在的 VPC 相同的 CIDR 前缀开始? - How can EC2 instance access internet IP starting with the same CIDR prefix of the VPC the EC2 instance is in?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM