Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am developing an app using PHP and deploying it on Apache on the Amazon AWS environment. This app requires to be made available to customers from their own chosen domain name?

How can I achieve this? For example:

www.customer1.com => /var/www/myapp.mydomain.com 
www.customer2.com => /var/www/myapp.mydomain.com

I would like to do this similar to how bitly enables shortened URL's for custom domains. www.myshorturl.com is DNS configured to a CNAME - cname.bitly.com.

Appreciate if someone could help me achieve this functionality.

If there are any other details required, please let me know, I shall update the same.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

There are several approaches to this.

  1. If this server hosts nothing else:

    • Make sure you have only one VirtualHost and that it's FIRST in the configuration.
    • Check that you can access the site (destination) via the raw IP, and by the Amazon domain name they give you (in the control panel, it's some numbers and letters then amazon.com)
    • Once you have this, you only need to tell your customers to set their A-record to your server's IP. (Now be careful -- you need to make sure you have this IP for as long as you have customers).
    • Alternatively, set on YOUR DNS records, [app.domain.com] --> [Amazon IP] and then tell your customers to make a CNAME. That way, if your IP changes, you can just change your CNAME and all the customers should be updated relatively quickly, automatically.
  2. If you use this server for many sites (and they are name-based VirtualHosts)

    • On the VirtualHost that runs this application, set ServerName [your-domain] and ServerAlias [buy-another-static-IP] because you can actually make Apache listen on a static IP on a per-virtual-host basis. (Amazon distributes these very cheaply). Make sure also in the config that Apache listens on ALL IP addresses, which would include the one you would buy/rent if you don't have it already.
    • Second option here is to use customer's domains (provided this is not automated and your customer-base is small) and do ServerAlias www.customer1.com and so forth.
share|improve this answer

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.