a month and a half working on a solution on this issue, and for more than a month one is already made the decision.
If the short is
- two KVM VPS in different data centers (400 - 700p per share)
- nginx:80 -> apache:8080
- Mysql replication master-master
- file replication via clsync
replication configs (nginx, apache, php, ssl, postfix) using clsync
- work with configs only on 1 server. Update SSL only on 1 server
- replication sessions using php memcachedrep
- DNS round-robin, 2 And write
- all traffic nginx transmit only on 1 server, the second marked as backup
- added monitoring via zabbix on everything to see what works
- you can still use a DNS hosting service with API to Zabbix is not available to remove the ip from the DNS issue.
Example: one of the servers is unavailable/disabled.
If you check how DNS works in round robin, you will notice this algorithm:
1) browser connects to 1 ip issued
2) tries to connect for 2 - 2.5 seconds
3) if not, then connects to the following ip
4) because 1 server is down, nginx switches to my internal apache and works with him
If interested, please, tell me https://t.me/konstantinti
If you want to do it all entirely by himself, please do.