2

I have a domain example.com that is being host on webfaction. However i would like to redirect its subdomain (e.g sub.example.com) to one of my AWS instance which has public DNS of:

https://ec2-xx-xxx-xxx-xxx.ap-southeast-1.compute.amazonaws.com:8083 (please note the port number).

This instance is then assigned with elastic IP address.

So far, the solution that i tried is:

  1. Using CNAME redirection, however it does not work because of this: https://forums.aws.amazon.com/thread.jspa?threadID=55995

  2. Then i proceed to use the old fashion .htaccess:

    Redirect permanent / http://ec2-xx-xx-x-xxx.compute-1.amazonaws.com order deny,allow

    However, i want to keep the sub.example.com on the address bar instead of changing it AWS public dns.

Does anyone know what is the best way to solve this? Thanks

Jeremy
  • 2,516
  • 8
  • 46
  • 80

1 Answers1

1

If you have assigned an elastic ip to the instance, you should be able to just setup a new 'A' record in your DNS that points directly to that IP address, no?

The listening on the specific port should be handled by the bindings on the instance (either thru apache or IIS)

E.J. Brennan
  • 45,870
  • 7
  • 88
  • 116
  • thanks, it works. I did it exactly like what you said.As for the port thing, I ended up reverse proxy it using nginx. – Jeremy Feb 01 '15 at 02:18
  • I have added the domain to the server (Mochahost) using a nameserver. Am I able to add a new 'A' record to the DNS (Namecheap) to redirect a subdomain to a web, hosted in AWS? Or should I redirect from the server and configure something in AWS? – Wenuka Dec 29 '19 at 15:29