CH-J Toolsserver management over SSH
Menu
All guides and articles →

How to run a website on two geographically separate servers

Experience with CH-J node pairs: coherent publication, signatures, local verification, readiness, failover, and static mirroring limits.

The second server must be independently usable

Two servers increase availability only if the other one actually has the necessary content, configuration, and user experience working. A directory copy alone does not address TLS, DNS, dynamic data, or erroneous publication. In the CH-J infrastructure, we use a separate primary and remote mirror node; public IPv4 and IPv6 may have different network paths.

This experience is about publishing web content and verified revisions. It is not a one-size-fits-all guide to actively writing to a single database from both locations. Forms, accounts, and other state need their own decisions about authoritative writing, replication, and conflict resolution. Having the same HTML on two nodes does not prove the readiness of an entire dynamic application.

Make changes in controlled staging

With a direct copy of a mutable webroot, the recipient may receive part of the old publication and part of the new one. For example, a router will start referencing a file that has not yet been transferred. The publication process therefore requires a common transaction contract for all writers and a coherent point in time for the candidate to be acquired.

On CH-J, the working staging is separated from the active immutable revision. Articles in this series go through a common publish transaction and only then through the existing synchronization service. This does not mean holding a lock throughout the slow network transfer. Its purpose is consistent input, while the network and activation process have their own protections.

Signature and checksums have specific roles

The checksums describe the expected bytes of the publication, and the signature ties the inventory to the authorized publisher. The recipient must verify both relationships, not just that they were able to download a file named manifest. The SSH transfer itself does not prove that the resulting activated tree corresponds to the complete intended release.

Each node should evaluate the local candidate and its binding to a specific root. In case of error, the expected hash should not be overwritten with the content just detected, as this would remove the evidence of non-compliance. Immutable revision and separate rights reduce risk, but do not replace protected signature material and regular checking.

Activation should be atomic and verified

Prepare new content next to the active one, perform configuration test and necessary HTTP checks, and only then switch the active link. In case of failure, keep or restore the previous verified revision. For CH-J, failure after activation and return was also verified in the previous integration test. This does not mean that we regularly intentionally cause a similar outage in production.

Graceful reload can reduce the impact of a change, but it does not resolve incorrect content or every dependency. Check that the new version actually serves the expected URL. Running NGINX itself may return a wrong router or an old revision. For caches or multiple addresses, test a specific node with the correct hostname and TLS authentication.

Health and readiness are not the same thing

A lightweight health endpoint can confirm that the web server is responding. Readiness must assess whether the node is ready to serve the intended publication. A PHP outage can leave a static health 200 even though dynamic pages are down. The two checks have different uses and should not give each other false green lights.

Monitoring should also track the age of the synchronization, the result of the last verification, disk space and local errors. A successful transfer a week ago is not a current confirmation of readiness. However, checks should not recalculate the entire content at every short interval and burden normal operation; an extensive audit belongs to a suitable controlled process.

Switching traffic needs its own plan

DNS cache, TTL, and client behavior mean that a record change may not be immediate for everyone. Check IPv4 and IPv6 separately. If both public addresses pass through the same point of failure, two backend copies will not help. Similarly, a mirror in the same electrical and network domain is not a full-fledged solution to a geographic outage.

Before the exercise, verify TLS, required hostnames, and write restrictions on the second node. Don't switch over your entire production just because one GET passed. This article does not perform a new failure test; it relies on the established publishing process and currently verified articles on both nodes.

Operational check of a pair of nodes

  • Each node has the necessary local publication and configuration.
  • A candidate emerges from consistent staging.
  • Signature and totals are verified before activation.
  • Readiness distinguishes available process from usable content.
  • There is a tested rollback and a separate dynamic write plan.

The benefit of second place is that it is a repeatable process. That is why after each new article we check both the public output and the second replica before marking the list. Two copies are useful if you know exactly what is running on them and how to safely decide which one is ready to serve users.

Frequently asked questions

Is it enough to sync the entire live webroot?

Without consistency, there is a risk of mixed publication. A verified candidate and controlled activation are more appropriate.

Is health 200 proof of working PHP?

Not necessarily. Health and readiness can be verified by different layers.

Does file mirroring resolve database conflicts?

No. Dynamic state requires a separate architecture.

Detailed documentation

rsync: transfer and control documentation →

NGINX: upstreams and routing →

CH-J Software: public project →

Biometric unlock and security →

All tutorials by category →