nginx can be used as webserver, web-proxy and even mail-proxy.

Picture Author

“Apache ist aufgrund seiner Architektur und Arbeitsweise doch eher der Traktor unter den Webservern.” X-D (src)

let me try to translate:

“Apache is due to its architecture and functioning rather the tractor under the web servers” (not the ferrari)

So it makes sense to try some kind of server-side- or even client-side-mysql+php7+apach2-generated-web-caching.

Actually performance increased massively with php7 – nginx was designed to be a proxy and therefore serves static files about 10x times faster than Apache(2?). (src from 2013)

But well i guess web pages can never load fast enough.

Unfortunately i could not find any benchmark Apache2 with / without nginx proxy.

A reverse-proxy is caching requests of clients on the server-side – and tries to determine which files to serve from cache and which not – thus improving performance / responsetime / throughput of the server.

“This improves performance as the web cache is closer to the client, and more efficiently uses the application servers because they don’t have to do the work of generating pages from scratch each time.” (src)

The tricky part – of course – is to determine – when to use the cache and when not.

If you are writing a blog – and you update a blog-post – you want to see the result immediately – not in 3 hours – when the cache decided to refresh that page from server.

“There are potentially multiple caches between the web browser and the application server: the client’s browser cache, intermediary caches, content delivery networks (CDNs), and the load balancer or reverse proxy sitting in front of the application servers. Caching, even at the reverse proxy/load balancer level, can greatly improve performance.” (src)

VestaCP – control panel is using apache2 and nginx as reverse-caching-proxy.

It runs well – as i often say – the RAM goblling application is MySQL – slowing everything else down. (it usually tries to use 4GByte of 2GByte existing real RAM)

Is the “content caching” only available in the costly 2500USD/year nginx plus version?

I can’t really tell.

Also: Is it doing RAM caching?

I can’t tell.

RAM caching would be of course way faster than harddisk caching.

Squid can do both.

“If you want 100% memory solution you can just configure ramdisk and serve data from there.” (src)

… you must be kidding me.

No! The concept should not be “either RAM or Harddisk” but “hybrid” like this:

L1 = 10% of RAM (small but fast, caches the most often requested files)

L2 = 10% of HARDDISK (preferable SSD, caches the less requested files).

Nginx was made to be a reverse proxy.

Initially all it did was serve static files and reverse proxy to a backend server via HTTP/1.0.

Since then fastcgi, load balancing and various other features has been added, but it’s initial design purpose was to serve static files and reverse proxy.

And it does this really well.” (src)

The benefits of content caching include:

  • Improved site performance – NGINX Plus serves cached content of all types at the same speed as static content, meaning reduced latency and a more responsive website.
  • Increased capacity – NGINX Plus offloads repetitive tasks from your origin servers, freeing up capacity to service more users and run more applications.
  • Greater availability – NGINX Plus insulates your users from catastrophic errors by serving up cached content (even if it’s stale) when the origin servers are down.
Pricing per instance: Open Source NGINX vs NGINX Plus
Annual Support (Basic) from NGINX, Inc.
Annual Support (Professional) from NGINX, Inc.
Annual Support (Enterprise) from NGINX, Inc.
Volume and unlimited-use pricing

If there is a nginx-web-cache – where is it?

http {
    proxy_cache_path  /data/nginx/cache  levels=1:2    keys_zone=STATIC:10m
    inactive=24h  max_size=1g;
    server {
        location / {
            proxy_pass   ;
            proxy_set_header       Host $host;
            proxy_cache            STATIC;
            proxy_cache_valid      200  1d;
            proxy_cache_use_stale  error timeout invalid_header updating
                                   http_500 http_502 http_503 http_504;



website of author –

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!