A
A
AlexWasHere2014-11-03 14:29:37
PHP
AlexWasHere, 2014-11-03 14:29:37

Why does nginx take a long time to give the site?

A server was raised on the computer in the following bundle nginx + fastcgi + php + mysql. The main page of a local site opens in 5-8 seconds, while on a remote working server it takes less than a second.
d66a68028ac3499e8427574e6331d84a.jpg
There is nothing in the nginx logs. What could be the reason? Where to dig?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
AlexWasHere, 2014-11-04
@AlexWasHere

A day later, I found the cause of my problem. As it turned out, everything was due to the XDebug module, which I connected to debug scripts. As soon as I turned it off, the site began to open in ~ 300 ms. In fact, it's enough to turn off profiling in php.ini
Now everything flies for me!

S
Sergey Petrikov, 2014-11-03
@RicoX

nginx is a frontend, it gives back when the backend gives it information, you have php and mysql on the back, I know that one of them slows down. Do profiling for your scripts, watch slow queries to the database, in such a bundle as you have in nginx there is simply nothing to slow down.

A
Andrey, 2014-11-04
@andreyvlru

It is very likely that the problem is in the long resolve localhost to ip address.
I was very similar. Php connected to the database for a few seconds.
A simple solution is to connect to 127.0.0.1 (do not use localhost)
Another option is to try adding the following entries to hosts
127.0.0.1 localhost
::1 localhost
It worked for me and everything started to open instantly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question