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

**URL:** <https://www.ruby-forum.com/t/502-errors-while-running-elgg-social-network-app-used-the-common-solutions-already/235800>\
**Category:** NGINX\
**Created:** [July 16, 2013, 6:55pm UTC](https://www.ruby-forum.com/t/502-errors-while-running-elgg-social-network-app-used-the-common-solutions-already/235800 "2013-07-16T18:55:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [July 16, 2013, 6:55pm UTC](https://www.ruby-forum.com/t/502-errors-while-running-elgg-social-network-app-used-the-common-solutions-already/235800/1 "2013-07-16T18:55:58Z")

</div>

greetings!

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 -  
[http://www.elgg.org](http://www.elgg.org))  
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  
busy  
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  
high  
enough specification (1GB RAM + 1 CPU (2.4GHz).

these are some of the relevant entries for the conf file for the site  
that  
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\_pass 127.0.0.1:9000;  
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  
pages  
on my site is higher than most websites.  
any tips welcome…  
thanks

Posted at Nginx Forum:

> **[502 errors while running elgg social network app.. used the common solutions...](https://forum.nginx.org/read.php?2,240922,240922#msg-240922)**
>
> greetings! 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...

---

<div class="post-metadata">

**Author:** ![tunist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/898d66/32.png) [@tunist](https://www.ruby-forum.com/u/tunist)\
**Post date:** [July 17, 2013, 2:56am UTC](https://www.ruby-forum.com/t/502-errors-while-running-elgg-social-network-app-used-the-common-solutions-already/235800/2 "2013-07-17T02:56:13Z")

</div>

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:

> **[Re: 502 errors while running elgg social network app.. used the common...](https://forum.nginx.org/read.php?2,240922,240927#msg-240927)**
>
> greetings! 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...
