Nginx – Setting up a CNAME setup for a web app


I am running Nginx (EngineX) and I am trying to setup a CNAME direct for people who want to use their own domain name for our service.

I have gotten as far as setting up => cname.php and it works fine, however when I point a separate domain to it's pointing back to the home page.

Any ideas / suggestions / solutions are appreciated.



Best Answer

A CNAME record is a pointer to another domain name record. It is not a pointer to a file. So, you will need to setup a number of things.

  1. Setup the CNAME record to point to the valid domain name of the server. e.g. =>
  2. Setup your webserver to serve files based on virtual hostnames. refer to the nginx documentation to do a simple vhost setup. This is most likely the step that you have left out. That is why you are getting the same homepage for different CNAMEs.
  3. Install the applications in each individual virtual host.
Related Topic