502 errors while running elgg social network app used the common solutions already


does anyone here have a reliable way of accurately calculating all the
various parameters that are used in the .conf files for nginx hosted
sites -
that may cause 502 errors if set inaccurately?

i am running an elgg social network (php code + mysql -
and recently i have been seeing 502 errors each time i clear the site’s
cache and then also on the main site sometimes after that…
after a while the issue clears and i am unsure why - the site is not
with traffic.
i also have a version of the site installed on my home pc which does not
have this issue - so i am thinking that possibly the server is not a
enough specification (1GB RAM + 1 CPU (2.4GHz).

these are some of the relevant entries for the conf file for the site
are being used currently:

nginx site conf:

large_client_header_buffers 4 8k;
client_header_buffer_size 2k;
fastcgi_index index.php;
client_max_body_size      200M;
client_body_buffer_size 650K;
proxy_read_timeout 300;
location ~ \.php$ {

include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 26k;
fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
expires max;

php-fpm conf:

pm.max_children = 16
pm.start_servers = 9
pm.min_spare_servers = 3
pm.max_spare_servers = 16
pm.max_requests = 250

– as you can see i have set some of these values much higher than is
commonly recommended - partially because i’m not entirely sure how large
they need to be and partially because the data transfer of some of the
on my site is higher than most websites.
any tips welcome…

Posted at Nginx Forum:

looks like i found the answer to this…
i needed to increase the fast_cgi_connect_timeout to 120 seconds as my
server is not so quick.

Posted at Nginx Forum: