Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an Elastic IP 192.0.2.4 for my EC2 instance for example.

I have a GoDaddy domain name www.example.com for example

I want my domain name www.example.com to load pages from http://192.0.2.4/a_sub_directory/ -- I have two queries about that.

  1. The other forums I browsed through (ServerFault and Quora) suggest I need to re-write the A Host's @ record to the Elastic IP that's connected to my EC2 instance. What if I want the domain name http://www.example.com to load up my page at http://192.0.2.4/a_sub_directory/ instead of the root directory at http://192.0.2.4/?

  2. GoDaddy domain manager has something called "Forwarding with Masking". Can I use that feature to load up my EC2 hosted instance from my GoDaddy domain name INSTEAD of changing any A record or anything?

share|improve this question
    
You can do all sorts of things, but why would you want to? Just setup the webserver on your EC2 instance to serve www.example.com out of whatever the actual docroot is. –  womble Jul 5 '12 at 11:49
    
i DID setup the webserver on my EC2 instance.......... I am trying to figure out how to connect my GoDaddy domain name with EC2 instances which is ALREADY serving my pages globally via elastic IP –  syedrakib Jul 5 '12 at 12:20

1 Answer 1

  1. Your elastic IP will allow you to have http://1.2.3.4/a_sub_directory/ which can be visited by anyone. However, A records are at the DNS level, they only allow you to point example.com into 1.2.3.4 so you'd have http://example.com/a_sub_directory/ - but it's not possible to remove a_sub_directory from this using DNS alone. You need another system.

  2. Yes, you can use this feature. Just forward/mask your domain onto http://1.2.3.4/a_sub_directory/ without changing any A records and you'll be done.

  3. A better solution would be to use Apache, and have example.com with a DocumentRoot of /var/www/html/a_sub_directory/. This way example.com will load everything from a_sub_directory but it's clean, and the user is none-the-wiser (it's what everyone does). You will need an A Record into 1.2.3.4. This comes from Virtual Hosting which many HTTP servers (Apache, Lighttpd, etc.) deal with very well - so you have example.net and example.com both on 1.2.3.4 but with two different directories serving their content.

It is worthy to note that forwarding/masking is not "clean". You can see the page load, then the frame load inside. Any links inside the masked frame will be of the form http://1.2.3.4/a_sub_directory/images/test.jpg and if a user does a Right Click > Copy Link then they'll get a http://1.2.3.4/a_sub_directory/... link, not example.com.

share|improve this answer
    
by the noteworthy point you mentioned, i understand it's best to re-write the A records to point to my Elastic IP. But the problem is, the root folder of my website is in a subdirectory of my AWS instance. Is there anyway i can make this work? –  syedrakib Jul 5 '12 at 11:40
    
Yes, please see the third point I added. If you are happy configuring Apache, this would be the perfect solution. –  Jay Jul 5 '12 at 11:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.