Create a subdomain pointing to other sobdomain (in a external server)

February 21, 2018 727 views
Nginx DNS

I have a website running with nginx (
I want this subdomain "" point to "".

What can I do?
The domain is hosted in nginx.


2 Answers

Point to your droplet and add the server block below to your NGINX configuration.

server {

  listen 80;
  listen 443;


  location / {
    return 301$request_uri;


Adjust this part of the entry return 301 https://f... to reflect if the destination is using SSL or not.

  • It work, but make a redirect to It's possible no make a redirect and load into

You could add a CNAME entry to observatorio.* that points to

On the destination server ( you will need to add an entry for to handle it properly.

  • In the destination server I nee setup a A record o a CNAME record?
    if is A record should be:

    If is a CNAME record should be:


    • I think you have it backwards from your original question and being your destination.

      Add one of the following to your DNS entries for

      If you want to use an A:Record

      • -- points to -->

      If you want to use a CName:Record

      • -- points to --> With a CName if the IP address for gets changed, then will be automatically updated.

      I can see you have already done this via the CNAME option

      At your destination ( you will need to add an entry for into your server configuration.

      For example if you're using NGINX then update the server_name directive to look like this.

Have another answer? Share your knowledge.