1. Problems to be solved
Putting static content on network storage or content distribution services is a technology that handles load. However, this technique requires you to change the access address of static content on the network storage, and requires modifications to the existing system, such as rewriting the URL address containing the static content or setting up filters for the web server.
2. Instructions for cloud mode
You can change the access address by using a proxy server without modifying the existing system. Set up a proxy server in front of the server where the content is saved to change the access address of the static content to the address corresponding to the network storage or content distribution service.
3. Implement
Use common software like Apache or Nginx to build a proxy server, and then put the proxy server in front of the existing system.
Run a proxy server (such as Nginx) that can rewrite content on an EC2 instance, and place the proxy server between ELB and S3 (for static content).
Add proxy server rules to modify the URL of specified content.
Apply Auto Scaling to the proxy server when necessary.
4. Configuration
5. Benefits
Use a proxy server to modify the access address so that the access load of static content can be distributed without modifying the existing system.
6. Precautions
In order to avoid a single point of failure, you must ensure the redundancy of the proxy server.
web/AP servers cannot be directly connected to ELB, so even if the number of web/AP servers (EC2 instances) is increased or decreased through auto scaling, they still cannot be directly connected to ELB.
The above has introduced Chapter 4, 7 Rewrite Proxy Pattern, including relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.