# 502 Proxy Error

**URL:** <https://www.ruby-forum.com/t/502-proxy-error/187112>\
**Category:** NGINX\
**Created:** [April 17, 2010, 11:03am UTC](https://www.ruby-forum.com/t/502-proxy-error/187112 "2010-04-17T11:03:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chuj625](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@chuj625](https://www.ruby-forum.com/u/chuj625)\
**Post date:** [April 17, 2010, 11:03am UTC](https://www.ruby-forum.com/t/502-proxy-error/187112/1 "2010-04-17T11:03:27Z")

</div>

i build a service with nginx  
When i visit it frequently(serval times per second, may be more  
frequently), it will delay the request or just give back “502 Proxy  
Error”  
What shall i do if i do not want it to delay requests or give back 502  
error?

Posted at Nginx Forum:

> **[502 Proxy Error](https://forum.nginx.org/read.php?2,76016,76016#msg-76016)**
>
> i build a service with nginx When i visit it frequently(serval times per second, may be more frequently), it will delay the request or just give back "502 Proxy Error" What shall i do if i do not want it to delay requests or give back 502...

---

<div class="post-metadata">

**Author:** ![chuj625](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@chuj625](https://www.ruby-forum.com/u/chuj625)\
**Post date:** [April 17, 2010, 11:10am UTC](https://www.ruby-forum.com/t/502-proxy-error/187112/2 "2010-04-17T11:10:29Z")

</div>

On Sat, Apr 17, 2010 at 05:02:21AM -0400, chuj625 wrote:

> i build a service with nginx  
> When i visit it frequently(serval times per second, may be more frequently),  
> it will delay the request or just give back “502 Proxy Error”  
> What shall i do if i do not want it to delay requests or give back 502 error?

Could you provide configuration file of your nginx.

–  
Sergey A. Osokin,  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![chuj625](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@chuj625](https://www.ruby-forum.com/u/chuj625)\
**Post date:** [April 17, 2010, 11:10am UTC](https://www.ruby-forum.com/t/502-proxy-error/187112/3 "2010-04-17T11:10:29Z")

</div>

On Sat, Apr 17, 2010 at 5:02 PM, chuj625 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> i build a service with nginx  
> When i visit it frequently(serval times per second, may be more frequently), it will delay the request or just give back “502 Proxy Error”  
> What shall i do if i do not want it to delay requests or give back 502 error?  
> To avoid 502 error, you should:check where the bottleneck is firstly.  
> Do you run php as fastcgi server, and 502 occurs when you access a PHP  
> page? If so, you would want to increase the size of buffer for fastcgi  
> communication. And, optimize the php script executive time is also  
> needed. E.g., optimize the database, in order to decrease the  
> executive time.

–  
Ren Xiaolei

---

<div class="post-metadata">

**Author:** ![chuj625](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@chuj625](https://www.ruby-forum.com/u/chuj625)\
**Post date:** [April 17, 2010, 12:50pm UTC](https://www.ruby-forum.com/t/502-proxy-error/187112/4 "2010-04-17T12:50:34Z")

</div>

1 worker\_processes 5;  
2 error\_log /var/log/nginx/error.log;  
3 pid /var/log/nginx/nginx.pid;  
4 worker\_rlimit\_nofile 8192;  
5  
6 events {  
7 worker\_connections 4096;  
8 }  
9  
10 http {  
11 default\_type application/octet-stream;  
12 log\_format main '$remote\_addr - $remote\_user [$time\_local] $status ’  
13 '“$request” $body\_bytes\_sent “$http\_referer” ’  
14 ‘“$http\_user\_agent” “$http\_x\_forwarded\_for”’;  
15  
16 upstream ltp\_server {  
17 server 192.168.1.1:12345;  
18 server 192.168.1.2:12345;  
19 server 192.168.1.3:12345;  
20 server 192.168.1.4:12345;  
21 }  
22  
23 server { # LTP load balancing with password  
24 listen 54321;  
25 access\_log /var/log/nginx/ltp.server.access.log main;  
26  
27 location / {  
28 proxy\_pass http://ltp\_server;  
29 auth\_basic “TEST Web Service”;  
30 auth\_basic\_user\_file ltpasswd;  
31 }  
32 }  
33  
34 server { # TEST load balancing without password  
35 listen 12345;  
36 access\_log /var/log/nginx/test.server.access.log main;  
37  
38 location / {  
39 proxy\_pass http://ltp\_server;  
40 # auth\_basic “TEST Web Service”;  
41 # auth\_basic\_user\_file testpasswd;  
42 }  
43 }  
44 }

Posted at Nginx Forum:

> **[Re: 502 Proxy Error](https://forum.nginx.org/read.php?2,76016,76038#msg-76038)**
>
> i build a service with nginx When i visit it frequently(serval times per second, may be more frequently), it will delay the request or just give back "502 Proxy Error" What shall i do if i do not want it to delay requests or give back 502...

---

<div class="post-metadata">

**Author:** ![chuj625](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@chuj625](https://www.ruby-forum.com/u/chuj625)\
**Post date:** [April 17, 2010, 1:01pm UTC](https://www.ruby-forum.com/t/502-proxy-error/187112/5 "2010-04-17T13:01:42Z")

</div>

well, you mean it is not a nginx problem?

i have to see if there is any problem with my project  
sometimes it does go really well, but 502 problem occures every now and  
then

ps. it’s not a php service

Posted at Nginx Forum:

> **[Re: 502 Proxy Error](https://forum.nginx.org/read.php?2,76016,76039#msg-76039)**
>
> i build a service with nginx When i visit it frequently(serval times per second, may be more frequently), it will delay the request or just give back "502 Proxy Error" What shall i do if i do not want it to delay requests or give back 502...

---

<div class="post-metadata">

**Author:** ![chuj625](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/977dab/32.png) [@chuj625](https://www.ruby-forum.com/u/chuj625)\
**Post date:** [April 17, 2010, 3:51pm UTC](https://www.ruby-forum.com/t/502-proxy-error/187112/6 "2010-04-17T15:51:24Z")

</div>

On Sat, Apr 17, 2010 at 7:00 PM, chuj625 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> well, you mean it is not a nginx problem?
> 
> i have to see if there is Â any problem with my project  
> sometimes it does go really well, but 502 problem occures every now and then
> 
> ps. it’s not a php service

## Hmm, proxy app. Check error.log file, see what happens.

Ren Xiaolei
