Bad gateway error from nginx

Hi

I configured Nginx to serve as a reverse proxy for Apache. Sometimes
Nginx is giving bad gateway error.

This is how nginx configuration is done

server {
client_max_body_size 20M;
listen 80;
server_name sq-fe1.example.com;
access_log /var/log/nginx/proxy.access.log;
error_log /var/log/nginx/proxy.error.log;

location / {
limit_conn one 100;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
proxy_buffers 8 16k;
proxy_buffer_size 32k;

}
}


Regards

Basil Kurian

Mr Basil Kurian,

      it seems to be server on port 8080 is not responding properly

. make sure that apache in the backend is running on 8080 .

Posted at Nginx Forum:

On Thu, Mar 31, 2011 at 10:45:58AM +0530, Basil Kurian wrote:

I configured Nginx to serve as a reverse proxy for Apache. Sometimes
Nginx is giving bad gateway error.

If you ever see nginx error or unexpected action, you should look
nginx error_log.


Igor S.
http://sysoev.ru/en/

This is the error I 'm getting on nginx

==> /var/log/nginx/proxy.error.log <==
2011/04/01 14:20:41 [error] 2494#0: *106 upstream prematurely closed
connection while reading response header from upstream, client:
172.16.50.99, server: sq-fe1.example.com, request: “GET / HTTP/1.1”,
upstream: “http://127.0.0.1:80/”, host: “sq-fe1.example.com:8000

Later i found in apache error log that, the problem is with apache

==> /var/log/apache2/error.log <==
*** glibc detected *** /usr/sbin/apache2: double free or corruption
(out): 0x00007f8859724c00 ***
======= Backtrace: =========
/lib/libc.so.6(+0x71ad6)[0x7f88571b3ad6]
/lib/libc.so.6(cfree+0x6c)[0x7f88571b884c]
/usr/lib/apache2/modules/libphp5.so(_zend_hash_add_or_update+0x1ae)[0x7f8853f885ae]
/usr/lib/apache2/modules/libphp5.so(+0x367d2a)[0x7f8853fcad2a]
/usr/lib/apache2/modules/libphp5.so(execute+0x210)[0x7f8853fa1dc0]
/usr/lib/apache2/modules/libphp5.so(zend_execute_scripts+0x15d)[0x7f8853f7977d]
/usr/sbin/apache2(ap_run_process_connection+0x68)[0x7f8857fb8478]
/usr/sbin/apache2(+0x5a807)[0x7f8857fc6807]
/usr/sbin/apache2(+0x5ab1a)[0x7f8857fc6b1a]
/usr/sbin/apache2(ap_mpm_run+0xc24)[0x7f8857fc77a4]
/usr/sbin/apache2(main+0xb40)[0x7f8857f9ca90]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7f8857160c4d]
/usr/sbin/apache2(+0x2fa29)[0x7f8857f9ba29]
======= Memory map: ========
7f8840000000-7f8840021000 rw-p 00000000 00:00 0
7f8840021000-7f8844000000 —p 00000000 00:00 0
7f8847848000-7f8849848000 rw-s 00000000 00:04 19215
/dev/zero (deleted)
7f8849848000-7f884985e000 r-xp 00000000 fe:02 402653441
/lib/libgcc_s.so.1
7f884985e000-7f8849a5d000 —p 00016000 fe:02 402653441
/lib/libgcc_s.so.1
7f8849a5d000-7f8849a5e000 rw-p 00015000 fe:02 402653441
/lib/libgcc_s.so.1
7f8849a63000-7f8849a64000 —p 00000000 00:00 0
7f8849a64000-7f884a264000 rw-p 00000000 00:00 0
7f884ba52000-7f884ba57000 r-xp 00000000 fe:02 402653759
/lib/libnss_dns-2.11.2.so

So we need to fix it.

Thanks a lot for your attention.

On 31 March 2011 11:30, Igor S. [email protected] wrote:

Igor S.
Igor Sysoev


nginx mailing list
[email protected]
nginx Info Page


Regards

Basil Kurian