I have a lamp server running a few wordpress sites. I'm investigating running a vps with nginx on it as caching proxy server.

I used vegeta from github to load test. I ran a bunch of tests using a connection rate of 100 per second connections for 5 seconds which gave me a certain failure rate. This is to the home page of the wordpress site.

I then set up an extremely simple nginx virtual server (on the same box as the virtual server running the wordpress sites). With nginx the performance was much worse according to the load test.

I was seeing a large number of 499 responses in the nginx logs.

I'm really surprised that my apache/php wordpress site works better than the nginx caching server. I do know that nginx is caching the page because when I download headers with curl I do get the "HIT" header. Also, if I tail my origin servers access log I only see access to the page on the initial load. After that nginx responds all by itself.

Putting nginx onto the same vps had very little effect.

My nginx config is:

proxy_cache_path /home/cache levels=1:2 keys_zone=my_cache:10m max_size=20g
                 inactive=60m use_temp_path=off;

server {
    location / {
        proxy_cache my_cache;
        add_header X-Proxy-Cache $upstream_cache_status;
        proxy_pass http://plettretreat.co.za/;

I've tried googling because there's obviously something I'm not doing right but I'm not getting to the correct info.

My VPS are openvz. Each box has 32Gb RAM.

Does anyone know what the issue could be, or a link to setting up a caching server with useful info (the regular run of the mill stuff out there just talks about the basic setup and promises of things working wonderfully which is not the case here)..

I have tried setting various properties on openvz like networking io buffer size etc. It had a marginal improvement, but not much

  • I am not surprised that Apache+PHP is faster than nginx+Apache+PHP. Run a fair test. – Michael Hampton Mar 11 '18 at 21:34
  • Hi Michael... Thanks for the reply. I get what you're saying but I thought that the point of having nginx as the caching server is that it eliminates the apache+php part once the cache is linted. This seems to be the case, as I mentioned I don't see further access on the origin server in my tests. – John Mc Murray Mar 12 '18 at 5:09
  • You can cache in Apache too – Orphans Mar 13 '18 at 8:32
  • WordPress does not have great performance out the box. As a result there are literally thousands of guides and plugins with the purpose of speeding up WordPress. I'd suggest starting there with your favourite search engine. Minor things I noted: Old PHP version; insecure http (http2 with TLS is faster); use a CDN – zaTricky Mar 14 '18 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.