Create a sub domain that points to a sub domain of another domain

1

I have a domain (domainpropio.com) and I need to put a sub domain (observatorio.dominiopropio.com). The detail is that the sub domain must point or load the content of another sub domain of a different domain (content.otherdomain.com).

How can I do that? The domainpropio.com website is a nginx server.

Thank you.

    
asked by Juan Carlos Loáisiga Montiel 21.02.2018 в 16:51
source

1 answer

0

What you are looking for is a proxy_pass. And you should separate two server blocks for the domain and for the subdomain. Example:

server{
  listen 80;
  server_name dominiopropio.com;

  #haz lo que quieras aqui;

}

server{
  listen 80;
  server_name observatorio.dominiopropio.com;

  location / {
      proxy_pass http://contenido.otrodominio.com$request_uri;
  }

}

But observatorio.dominiopropio.com must be configured in your other domain.com to be received. If what you want is that when you enter the subdomain, just do a 301 instead of proxy_pass.

    
answered by 20.01.2019 в 01:41