I've got a VPS
512MB RAM with 2048MB avail in peaks
PHP 5.3 (fcgi)
and it is hosting just one website with barely any traffic for now.

Regrettably it will get stuck every so often resulting 504 bad gateway for customers making demands. Only at that moment htop shows literally no activity whatsoever. No CPU usage, no SWAPING - nothing. Used to do run ab test on 1000's of demands also it made it it every time.

error_log shows only [error] for vbulletin scripts "Premature finish of script headers: php.fcgi" and [warn] "Timeout awaiting output from CGI script"

I personally use /var/www/cgi-bin/php.fcgi script:


Apache works in prefork mode with configurations:

StartServers      60
MinSpareServers   60
MaxSpareServers   10
ServerLimit       60
MaxClients        60
MaxRequestsPerChild  1000

Question: What may be possible reasons for that? Where must i point at? Any hint is going to be appreciated.