Mobile app version of vmapp.org
Login or Join
Hamaas447

: Mirror website across different hosting accounts Is it possible to mirror a website across different hosting accounts, for example: exampleA.com (public) exampleB.com (private) When people access

@Hamaas447

Posted in: #MultipleDomains #ReverseProxy #WebHosting

Is it possible to mirror a website across different hosting accounts, for example:


exampleA.com (public)
exampleB.com (private)


When people access the website they will be visiting exampleA.com but everything that is requested will be coming from the private site (exampleB.com).

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Hamaas447

3 Comments

Sorted by latest first Latest Oldest Best

 

@Si4351233

You can do this in nginx by using the reverse proxy option, something like this will work:

server {
listen 80;
server_name exampleA.com exampleA.com; location / {
proxy_pass exampleB.com; proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}


The above code will effectively serve everything that's on exampleB.com but actually the user will be browsing the site using the public domain exampleA.com.

10% popularity Vote Up Vote Down


 

@Eichhorn148

Apache supports this feature, its called a reverse proxy. It will work whether or not the sites are served from the same server or not.

One way to do so would be to use mod_proxy with the Apache webserver. The configuration of the virtual host for public would look like this:

<VirtualHost *:*>
ServerName exampleA.com
ProxyPass / exampleB.com/ ProxyPassReverse / exampleB.com/ </VirtualHost>


Proxy directives can also added in the .htaccess file or triggered via mod_rewrite using the [P] (for proxy) flag.

10% popularity Vote Up Vote Down


 

@Gretchen104

If you are on the same server, then set the document root for exampleA.com to the same document root as exampleB.com.

Example:


Point them both to /the/path/to/hosting/folder


They should then show exactly the same content.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme