How to have different /servers with same Domain? How to have different /servers with same Domain? wordpress wordpress

How to have different /servers with same Domain?


What you are describing is a reverse proxy.

You can set it up using apache's extension mod_proxy. Personally I haven't touched that, but my opinionated answer would be to suggest you have a look at nginx. It's a dead simple reverse proxy. You can easily run nginx in front of apache, intercepting requests and passing them on to different servers or just send html-files directly.

A nginx-config can be as simple as:

server {    listen       80;    server_name  example.org  www.example.org;    location /mexico/ {        # We could have an apache server running on another port...        proxy_pass http://127.0.0.1:8000;    }    location /venezuela/ {                    proxy_pass http://123.123.123.123:8000;  # ...or another server.    }    location /bulgaria/ {        # Or just serve some static files         # In apache, do you set up a virtual host for this? christ.        root /var/www/static_html;        # If static html is all you have, what is apache even doing         # on your server? Uninstall it already! (As I said; opionated!)    }}

edit: Finding my own answer after a few years, I'd just like to add that the 301-rewrite rule that OP choose to go with adds another request that the browser must wait for before getting redirected to the real address. 301-requests are still to this day considered bad SEO, and adds some (usually minor) loading time.


You will need to use subdomains, and set the A records at your domain registrar to map each subdomain to the different servers.

Here is a related SO question. Note, it was closed, but the selected answer is what your going for: Subdomain on different host

one.yourdomain.com --> points to ServerA

two.yourdomain.com --> points to ServerB

There is info on GoDaddy's site too. If your not using GoDaddy, the process would be similar: https://support.godaddy.com/help/article/4080/managing-a-domain-names-subdomains

You go into your domain registrar where you can edit your domain settings. It will probably be in something about DNS. Your wanting to add a new "A Record".

Some registrars simply let you put in "yoursubdomain", the IP of the server, and the TTL (Time To Live).

So enter your the subdomain for your first one, the IP of the server you want it to point to, and the TTL (if it asks) which is usually 3600.

Then add another "A Record", only for your other subdomain, the IP for that server, and TTL.

Repeat for however many subdomains and servers you need.


your solutions is:

1.You can use A record & subdomains for every server.

2.You can use your webserver configuration to relay user to destination servers (Apache,NGINX & etc)

But here I see you'r asking about Wordpress from multi server. You can only have multi server for your static contents (CDN), but your database must be in one place except you want to use cloud DB.