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