502 Proxy Error

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:

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,
[email protected]

On Sat, Apr 17, 2010 at 5:02 PM, chuj625 [email protected] 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

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:

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:

On Sat, Apr 17, 2010 at 7:00 PM, chuj625 [email protected] 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