APache is installed and is used to serve mostly Djanfo/Python content. I want to install nginx to serve static content. How to do it and what is agood configuration.
I am on ubuntu and Apache was installed via apt-get.
|
feedback
|
btw - think about putting static content on another domain. this should improve end-user speed a little. | ||||
|
feedback
|
|
There are many variations on how to accomplish this. I prefer to have one application dedicated to deciding on which server handles what kind of content, while the back end servers simply serve the files they've been requested. To that end, I employ the Varnish reverse proxy on the front end, listening on port 80. Behind that, I have Apache (port 8880) and nginx (port 8881), both configured for the same domains and pointing to the same directory structure. In my Varnish config file, I have something like this:
Of course, there's a little more to it, but you get the idea. Since you already have Apache and nginx installed, you may want to browse this link, which describes a very simliar situation to yours, but uses nginx as the front end for static content and then passes on requests to Apache. If you want to go really simple, you could simply use a reverse caching proxy (such as Varnish or nginx) in front of Apache. What it will do is cache requests to quickly serve them out to clients, while at the same time relieving the web server itself from serving identical requests. This, by its very nature, will give the same effect as what you're asking for. Since static pages and images rarely change, they will be almost always cached by the front end, whereas dynamic pages will be detected as such and always passed on to the back end. | |||
|
feedback
|