For a website I’m developing all my static content is hosted offsite on a combination of S3/Cloudfront. I’ve been looking over a lot of tutorials for deploying a Django app into production and a lot of them recommend a combination of Nginx (reverse proxy) + Apache. This is stated under the assumption that Ngnix will be used for serving static contents and Apache will do all the heavy lifting. Are there any other reasons to have a reverse proxy when I don’t have any static contents to serve? Or in this case could I simplify my server setup and just use Apache?
Nginx will help in your use case as well. Generally, like any reverse proxy, it helps to utilize server resources more optimally with two major techniques:
- As you correctly pointed out, it serves static content, thus freeing a heavy-weight web server from doing this.
- But it also solves the problem of “slow clients”, i.e. those clients who use slow connections (dial-up or mobile). Since Apache generates a dynamic page pretty fast, Nginx gets it, stores to the temporary file and serves it to the client at the client’s speed (much like it would serve a static content), freeing Apache to serve another request.
- Reasons to have a use a reverse proxy on a website not serving static content (Django)?
- should I run nginx for static content on port 81 or set it up as reverse proxy to apache?
- Assuming I am not serving any static content, will I need to move away from Apache?
- how do reverse proxies know which content is static?
- How can I set up a reverse proxy for several web applications and static content?