Error 504 Gateway Timeout (VestaCP / Centos)

Please help me solve this problem.
I often experience 504 "Gateway Timeout" problems when running plugins in my wordpress. What is the way to solve this problem so I can not see again?
What with increasing php memory limit is the answer?
"Sorry if my english is not good."