2

I registered my domain name e.g."abc.com" under different company with DNS hosting. Therefore, all nameservers is on DNS hosting. But the issue happened when wanting to configure subdomain "xyz.abc.com" under other hosting.

On domain registrar, I changed the DNS records:

----------------------------------------------------------  
| Type  | Host         |        Answer      | TTL | Prio |
----------------------------------------------------------  
| CNAME | xyz.abc.com  | directedportal.com | 300 | N/A  |
----------------------------------------------------------

On Nginx configuration, at first, I set up like the following:
/etc/nginx/sites-available/xyz.abc.com and symlink to /etc/nginx/sites-enabled/xyz.abc.com:

server {
    listen 80;
    server_name xyz.abc.com;
    return 301 http://directedportal.com$request_uri;
}

The result is forwarding to the "directedportal.com". Then I changed to the following configuration:

server {
    listen 80;
    server_name xyz.abc.com;
    rewrite ^(.*)$ http://directedportal.com$request_uri? permanent;
}

What should I do so it can be really CNAME-binding? Thank you in advance

  • See if this helps some: http://stackoverflow.com/questions/30602324/how-to-detect-an-incoming-request-with-php-script-from-a-cname-subdomain/30630937#30630937. I'm not exactly sure what you're trying to achieve. The CNAME responds to a request for http://xyz.abc.com with http://directedportal.com, which should then change the client's browser to reflect the directedportal site. Then, you replaced that with a rewrite instead? – Rick Buford Jul 22 '15 at 23:16

0 Answers0