My setup:

  • nginx is listening on port 80 and working as a reverse proxy (plus directly sending static files)
  • Apache 2 is listening on port 8080
  • PHP is running in Apache 2
  • All running on one server (no internal network latency)

My problem:

Static files now are very fast, but everything going through the proxy takes a lot of extra time.

One example is a "search-as-you-type" tag suggestion box. When I connect to Apache directly though port 8080 everything is fine and the server responds quickly (~50 ms). When I use the "normal path" through port 80 (nginx -> Apache) every request takes about 15 times as long (~750 ms).

I expected some more time. Right now requests are not leaving the server in any way, so why do they take so much more time to process? How do I make them faster?

Is there any way I can use persistent connections between nginx and Apache?

Is there any way to benchmark where exactly that additional 0.7 second is added?

Main interest: Can I find out if this time comes from internal processing in nginx (e.g. hostname table lookup) or is it the connection to Apache. Is nginx waiting for an open socket - or what happens here?

  • 3
    Why are you using Apache at all? – Michael Hampton Mar 18 '14 at 17:44
  • Because I didn't have time to check/fix all schripts on the server for compatibility with another webserver. I may be able to do that in the long run - but right now it was "hdd crash - so I had to set up a new server and desided to try something new, because Apache was eating so many resources on static files". – BlaM Mar 18 '14 at 18:09
  • How do you proxy requests to Apache? If you use localhost:8080, try to use instead. – Alexey Ten Mar 18 '14 at 19:39
  • seems to be a little faster than localhost - but it's still slow. – BlaM Mar 19 '14 at 8:36
  • Is there anything in error.log? – Alexey Ten Mar 19 '14 at 21:02

Okay, I finally found my problem - and it looks as if I was causing my own problems:

I misconfigured limit_req_zone throttling my server down to a crawl slower than expected.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.