Search code examples
apacheconfigurationsubdomain

How to connect domain to another subdomain?


I have apache server. And I have my own domains:

  • domain.one
  • sub.domain.one

And I have another domain domain.two

I want, when people get to domain.two they will see content from sub.domain.one

I need find solution like a parking. NO redirect of iframe allow. When you open domain.two it opens sub.domain.one

For domain.two I made A-record with IP from sub.domain.one. But when visitor opens domain.two he see domain.one - but I need sub.domain.one

I think, at the configs of domain.one, I need make some changes, to let server know about customers domains exists.


Solution

  • Well, I manage it with nginx proxy.

    This is a scheme:

    1. Domain.com - A-record resolves to your NGINX proxy server.
    2. Nginx proxy server make proxy to your subdomain destination.

    Nginx config:

    server {
            server_name domain.com;
            location / {
                proxy_pass       http://sub.domain.com;
            }
    }