# 500 nginx bad gateway when Update vbulletin template

**URL:** <https://www.ruby-forum.com/t/500-nginx-bad-gateway-when-update-vbulletin-template/222762>\
**Category:** NGINX\
**Created:** [September 9, 2012, 11:36pm UTC](https://www.ruby-forum.com/t/500-nginx-bad-gateway-when-update-vbulletin-template/222762 "2012-09-09T23:36:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [September 9, 2012, 11:36pm UTC](https://www.ruby-forum.com/t/500-nginx-bad-gateway-when-update-vbulletin-template/222762/1 "2012-09-09T23:36:04Z")

</div>

hello

when i update template in vbulletin php forum i got this error in  
vhost-error\_log

2012/09/09 23:13:16 [error] 10313#0: \*3877 upstream prematurely closed  
connection while reading response header from upstream, client:  
192.168.1.1,  
server: [site.net](http://site.net), request: “POST  
/vb/admincp/template.php?do=updatetemplate  
HTTP/1.1”, upstream:  
“[http://66.212.18.72:8081/vb/admincp/template.php?do=updatetemplate](http://66.212.18.72:8081/vb/admincp/template.php?do=updatetemplate)”,  
host:  
“[www.site.net](http://www.site.net)”, referrer: “[http://www.site.net/vb/login.php?do=login](http://www.site.net/vb/login.php?do=login)”  
2012/09/09 23:14:17 [error] 10313#0: \*5145 upstream prematurely closed  
connection while reading response header from upstream, client:  
192.168.1.1,  
server: [site.net](http://site.net), request: “POST  
/vb/admincp/template.php?do=updatetemplate  
HTTP/1.1”, upstream:  
“[http://66.212.18.72:8081/vb/admincp/template.php?do=updatetemplate](http://66.212.18.72:8081/vb/admincp/template.php?do=updatetemplate)”,  
host:  
“[www.site.net](http://www.site.net)”, referrer:  
“[http://www.site.net/vb/admincp/template.php?s=&do=edit&templateid=2206&group=ad\_&searchstring=&expandset=32](http://www.site.net/vb/admincp/template.php?s=&do=edit&templateid=2206&group=ad_&searchstring=&expandset=32)”  
2012/09/09 23:16:02 [error] 10313#0: \*6896 upstream prematurely closed  
connection while reading response header from upstream, client:  
192.168.1.1,  
server: [site.net](http://site.net), request: “POST  
/vb/admincp/template.php?do=updatetemplate  
HTTP/1.1”, upstream:  
“[http://66.212.18.72:8081/vb/admincp/template.php?do=updatetemplate](http://66.212.18.72:8081/vb/admincp/template.php?do=updatetemplate)”,  
host:  
“[www.site.net](http://www.site.net)”, referrer:  
“[http://www.site.net/vb/admincp/template.php?s=&do=edit&templateid=2206&group=ad\_&searchstring=&expandset=32](http://www.site.net/vb/admincp/template.php?s=&do=edit&templateid=2206&group=ad_&searchstring=&expandset=32)”

so what’s the problem

thanks

Posted at Nginx Forum:

> **[500 nginx bad gateway when Update vbulletin template](https://forum.nginx.org/read.php?2,230591,230591#msg-230591)**
>
> hello when i update template in vbulletin php forum i got this error in vhost-error\_log 2012/09/09 23:13:16 \[error\] 10313#0: \*3877 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.1, server:...

---

<div class="post-metadata">

**Author:** ![iLinux85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea5d25/32.png) [@iLinux85](https://www.ruby-forum.com/u/iLinux85)\
**Post date:** [September 9, 2012, 11:49pm UTC](https://www.ruby-forum.com/t/500-nginx-bad-gateway-when-update-vbulletin-template/222762/2 "2012-09-09T23:49:30Z")

</div>

and here is the nginx configurations for the site

server {  
error\_log /var/log/nginx/vhost-error\_log warn;  
listen 192.168.1.1:80;  
server\_name [site.com](http://site.com) [www.site.com](http://www.site.com);  
access\_log /usr/local/apache/domlogs/site.com-bytes\_log  
bytes\_log;  
access\_log /usr/local/apache/domlogs/site.com combined;  
root /home/deltacom/public\_html;  
location / {  
location  
~._.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$  
{  
expires 7d;  
try\_files $uri @backend;  
}  
error\_page 405 = @backend;  
add\_header X-Cache “HIT from Backend”;  
proxy\_pass [http://192.168.1.1:8081](http://192.168.1.1:8081);  
include proxy.inc;  
}  
location @backend {  
internal;  
proxy\_pass [http://192.168.1.1:8081](http://192.168.1.1:8081);  
include proxy.inc;  
}  
location ~ ._.(php|jsp|cgi|pl|py)?$ {  
proxy\_pass [http://192.168.1.1:8081](http://192.168.1.1:8081);  
include proxy.inc;  
}  
location ~ /.ht {  
deny all;  
}  
}

Posted at Nginx Forum:

> **[Re: 500 nginx bad gateway when Update vbulletin template](https://forum.nginx.org/read.php?2,230591,230592#msg-230592)**
>
> hello when i update template in vbulletin php forum i got this error in vhost-error\_log 2012/09/09 23:13:16 \[error\] 10313#0: \*3877 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.1, server:...

---

<div class="post-metadata">

**Author:** ![iLinux85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea5d25/32.png) [@iLinux85](https://www.ruby-forum.com/u/iLinux85)\
**Post date:** [September 10, 2012, 12:02am UTC](https://www.ruby-forum.com/t/500-nginx-bad-gateway-when-update-vbulletin-template/222762/3 "2012-09-10T00:02:57Z")

</div>

sorry error is 502 not 500

502 Bad Gateway  
nginx

Posted at Nginx Forum:

> **[Re: 500 nginx bad gateway when Update vbulletin template](https://forum.nginx.org/read.php?2,230591,230593#msg-230593)**
>
> hello when i update template in vbulletin php forum i got this error in vhost-error\_log 2012/09/09 23:13:16 \[error\] 10313#0: \*3877 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.1, server:...

---

<div class="post-metadata">

**Author:** ![iLinux85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea5d25/32.png) [@iLinux85](https://www.ruby-forum.com/u/iLinux85)\
**Post date:** [September 10, 2012, 9:15pm UTC](https://www.ruby-forum.com/t/500-nginx-bad-gateway-when-update-vbulletin-template/222762/4 "2012-09-10T21:15:37Z")

</div>

hello

what exactly i should check regard this issue ?

thanks

Posted at Nginx Forum:

> **[Re: 500 nginx bad gateway when Update vbulletin template](https://forum.nginx.org/read.php?2,230591,230633#msg-230633)**
>
> hello when i update template in vbulletin php forum i got this error in vhost-error\_log 2012/09/09 23:13:16 \[error\] 10313#0: \*3877 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.1, server:...

---

<div class="post-metadata">

**Author:** ![iLinux85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea5d25/32.png) [@iLinux85](https://www.ruby-forum.com/u/iLinux85)\
**Post date:** [September 10, 2012, 8:41pm UTC](https://www.ruby-forum.com/t/500-nginx-bad-gateway-when-update-vbulletin-template/222762/5 "2012-09-10T20:41:44Z")

</div>

On Monday 10 September 2012 01:35:21 iLinux85 wrote:

> hello
> 
> when i update template in vbulletin php forum i got this error in  
> vhost-error\_log  
> […]  
> so what’s the problem

It looks like the problem is on php side.

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![iLinux85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea5d25/32.png) [@iLinux85](https://www.ruby-forum.com/u/iLinux85)\
**Post date:** [September 10, 2012, 9:18pm UTC](https://www.ruby-forum.com/t/500-nginx-bad-gateway-when-update-vbulletin-template/222762/6 "2012-09-10T21:18:32Z")

</div>

hi,

i’ve seen similar issues with apc enabled on php side. on my  
installation nginx returned an error 5xx as well when upgrading typo3  
core. may be restarting your php (or at least clearing byte-code-cache)  
helps.

regards,  
chris

Am 10.09.2012 um 21:14 schrieb iLinux85 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![iLinux85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea5d25/32.png) [@iLinux85](https://www.ruby-forum.com/u/iLinux85)\
**Post date:** [September 10, 2012, 9:26pm UTC](https://www.ruby-forum.com/t/500-nginx-bad-gateway-when-update-vbulletin-template/222762/7 "2012-09-10T21:26:08Z")

</div>

On Monday 10 September 2012 23:14:54 iLinux85 wrote:

> hello
> 
> what exactly i should check regard this issue ?

You should check the error log of your application server (php-fpm,  
apache, or  
whatever you use).

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![iLinux85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea5d25/32.png) [@iLinux85](https://www.ruby-forum.com/u/iLinux85)\
**Post date:** [September 13, 2012, 10:50pm UTC](https://www.ruby-forum.com/t/500-nginx-bad-gateway-when-update-vbulletin-template/222762/8 "2012-09-13T22:50:50Z")

</div>

here is my main nginx.conf

user nobody;

# no need for more workers in the proxy mode

worker\_processes 2;  
error\_log /var/log/nginx/error.log info;  
worker\_rlimit\_nofile 20480;  
events {  
worker\_connections 5120; # increase for busier servers  
use epoll; # you should use epoll here for Linux kernels 2.6.x  
}  
http {  
server\_name\_in\_redirect off;  
server\_names\_hash\_max\_size 10240;  
server\_names\_hash\_bucket\_size 1024;  
include mime.types;  
default\_type application/octet-stream;  
server\_tokens off;  
#disable\_symlinks if\_not\_owner;  
sendfile on;  
tcp\_nopush on;  
tcp\_nodelay on;  
keepalive\_timeout 5;  
gzip on;  
gzip\_vary on;  
gzip\_disable “MSIE [1-6].”;  
gzip\_proxied any;  
gzip\_http\_version 1.1;  
gzip\_min\_length 1000;  
gzip\_comp\_level 6;  
gzip\_buffers 16 8k;

# You can remove image/png image/x-icon image/gif image/jpeg if you have

slow CPU  
gzip\_types text/plain text/xml text/css application/x-javascript  
application/xml image/png image/x-icon image/gif image/jpeg  
application/xml+rss text/javascript application/atom+xml;  
ignore\_invalid\_headers on;  
client\_header\_timeout 3m;  
client\_body\_timeout 3m;  
send\_timeout 3m;  
reset\_timedout\_connection on;  
connection\_pool\_size 256;  
client\_header\_buffer\_size 256k;  
large\_client\_header\_buffers 4 256k;  
client\_max\_body\_size 200M;  
client\_body\_buffer\_size 128k;  
request\_pool\_size 32k;  
output\_buffers 4 32k;  
postpone\_output 1460;  
proxy\_temp\_path /tmp/nginx\_proxy/;  
client\_body\_in\_file\_only on;  
log\_format bytes\_log “$msec $bytes\_sent .”;  
include “/etc/nginx/vhosts/\*”;  
}

Posted at Nginx Forum:

> **[Re: 500 nginx bad gateway when Update vbulletin template](https://forum.nginx.org/read.php?2,230591,230682#msg-230682)**
>
> hello when i update template in vbulletin php forum i got this error in vhost-error\_log 2012/09/09 23:13:16 \[error\] 10313#0: \*3877 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.1, server:...
