1. Create example.com website in A server
  2. Create an empty site on server B using your domain name
  3. Add a reverse proxy on server B
    Target URL:http://x.x.x.xyour server a ip
    Sent Domain:example.com your server a domain name
  4. Resolve your domain name a record to server b in cloudflare
    a month later

    aaPanel_Jose thank you it is working fine. There an option for enable cache. Should I enable it? Any benifit ?

    Caching is always good, can save much resources.
    When you have Wordpress site, then Cloudflare + WPRocket or any 1 cache plugin is enough.

    a month later

    I enabled cache for reverse proxy but what is the recommended cache minutes hours? leave it as default 1min ?

    3 months later

    Can someone help please? when I enable cache in reverse proxy, can't log in in wp-admin of my site.

      jabr don't enable cache in reverse proxy. After enabling cache login issue comes.

      7 months later

      aaPanel_Jose

      1. Create example.com website in A server
      2. Create an empty site on server B using your domain name

      Is your domain name on point number 2 a random domain or it should be the same as example.com on point number 1?

      a year later

      x3inspire
      What error message is there when I log in after enabling the cache? Check logs and error logs
      Cache these files after opening the cache gif|png|jpg|css|js|woff|woff2
      You can modify the Conf to remove the affected files

        5 months later

        Hi, i think i manage to make the reverse proxy working... i test it by typing the server B's domain(i use my direct ip) and it directs me to server A website, but the url changes to server A's domain. how to be able to show the server A content while the url still from the server B's domain?

        Considering you're talking about reverse proxy and not redirect, you should be able to fine tune any detail about it. Maybe try to indicate the domain you want to display in the address bar in the headers, like this, beside the proxy_pass directive:

        proxy_set_header Host server_b_domain;

          hilord Hi, thanks for your suggestion, I tried this using different site with a domain name instead as the server B's domain name. but the url, still changes to server A's domain.

            aaP_fallingrais Hmmm, did you well restart the web server service (nginx or apache?) after the modification in conf? Did you test the validity of the overall config (e.g. "nginx -t") with success?

            About the 502 Bad Gateway, it says that the proxy received an invalid response from the upstream server... It could be because there's no valid certificate at a point, because the target server doesn't listen to the port 443 on the right IP, because there's too many redirections (e.g. sometimes when the proxy sends the wrong scheme in headers* and final server is trying to force SSL while it's already there)... Well, first, maybe you should look at both server logs.

            *proxy_set_header X-Forwarded-Proto http;