Mobile app version of vmapp.org
Login or Join
Cooney921

: How can I point wildcard domains to a folder in Apache? 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

@Cooney921

Posted in: #Apache #Bitly #Cname #Dns #Virtualhost

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:
customer1.com => /var/www/myapp.mydomain.com customer2.com => /var/www/myapp.mydomain.com


I would like to do this similar to how bitly enables shortened URL's for custom domains. 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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Cooney921

1 Comments

Sorted by latest first Latest Oldest Best

 

@Carla537

There are several approaches to this.


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.

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 customer1.com and so forth.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme