Custom URL / Domain (Alias ​​CNAME?)

I am creating an application on the LAMP stack, and I want to give the user the opportunity to use their own domain instead of the subdomain of my site. eg.

Instead of http://some_user.mysite.com

They will use: http://store.some_user.com/

I know that there are several companies that provide this using CNAME records. ( http://help.bigcartel.com/articles/14-using-a-custom-domain ), however I'm not sure how they achieve this in its entirety.

My questions:

  • What is this process called? (So ​​I can explore this further if necessary)

  • What do I need to do to ensure this? i.e. What do I need to do for DNS, apache and php for this to work?

Any tips, links, or code snippets are welcome.

thanks


UPDATE

So far, I have managed to set up a wildcard DNS record, but I'm still having problems with a CNAME record that resolves a different domain. eg.

http://store.weareunified.com/ β†’ http://weareunified.joshstuart.com.au/

weareunified.com ( this is a test user host ) DNS

weareunified.com. A 111.67.3.227 store CNAME weareunified.joshstuart.com.au. 

joshstuart.com.au ( This is the main application host ) DNS

 joshstuart.com.au. A 111.67.3.227 * CNAME joshstuart.com.au. 
+6
php dns lamp domain-name cname
source share
5 answers

I have this setting using LAMP and it works very well. Here is how I did it:

  • The target server with my application on it is in the usual domain A (under). Therefore, in your case, I assume that the application runs on joshstuart.com.au .
  • The customer needs to change their DNS record for store.weareunified.com to CNAME before joshstuart.com.au.
  • Apache server has a virtual host without a domain specification (in my case), just <VirtualHost *:80>

What is it. Currently, 70 CNAME domains belong to the main domain of the application, and each of them maintains its own separate site as necessary (without redirection, etc.).

+7
source share

Actually, you do not need to do anything.

Your users need their DNS provider to add a CNAME record, which basically maps to http://app.some_user.com/ to http://some_user.app.com .

Every DNS client looking for http://app.some_user.com/ is invited to search for http://some_user.app.com , and therefore this is a DNS / client problem, not a server problem.

Amazon recommends this technique for users of EC2 servers.

Please note that CNAME records have a limitation; they cannot be assigned to the root of the domain - your users cannot assign http://some_user.com/ , only http://app.some_user.com/ as CNAME.

+5
source share

I have something similar that I did with cpanel api2.

Basically, a user points his domain to my DNS, and I use api to park my domain on mine.

I store every user domain in a database.

When the page loads, I retrieve the http_host and compare it with my database to see if the domain exists. Then I load the page based on user settings (I serve all pages from the same script) and database entries.

To reduce the load on the database, I save the information in the session that defines the host. Then I can check this every subsequent load, and not check the database every time.

+1
source share

Another possibility is to actually be the host of the DNS user and process all the records. You can get an open source solution. (But you may need your own two DNS servers on different subnets).

0
source share

There are several different parts here - setting up DNS records and then getting Apache to respond to the request.

Do you have a CNAME configured for the client? Please note: you cannot configure CNAME on weareunited.com, it must be on store.weareunited.com or some other host name that is not the root domain.

You don't seem to understand how CNAME works. Too simplified version when the user asks store.weareunited.com for their local name server (for example, the name server that is located in the ISP of the end user. For me at Comcast, this is usually Comcast NS in Beaverton, OR. The local name server has not resolved the name yet host and does not have it in the cache) will query the root name servers to determine who is responsible for the domain. Then the local namserver will query the domain name server to get the record. An entry can be an A entry, which is an IP address, or a CNAME that points to a different host name.

When the local names get CNAME, he will start this process again to get the A record. As soon as he finally gets the A record with the IP address, he will return the IP address to the end user browser and the web browser will send an IP request -address.

The end result: the web browser obtains an IP address, and then makes a request to this IP address using the original host name as the host header store.weareunited.com. Therefore, Apache must be configured to receive requests for the hostname store.weareunited.com.

PHP doesn't care about what the host name is unless you check for environment variables like $ _SERVER ...

You can get your customers to configure CNAME at joshstuart.com.au. You could create additional host names, for example weareunited.joshstuart.com.au, or create a wildcard, and then your customers set the CNAME target for this unique host name, but why bother? I would just:

 store.weareunited.com. 3600 IN CNAME joshstuart.com.au. 

While joshstuart.com.au then passes the IP address to your web server, CNAME will work. As I mentioned above, Apache will see a request coming to store.weareunited.com, so you need to either set up a virtual host for that hostname, or create a shared ghost, as Berkeley mentions (although I'm not sure if the apache directives that you would use to ensure that the request is then matched with the appropriate files for the domain ...).

0
source share

All Articles