# 502 bad gateway

**URL:** <https://www.ruby-forum.com/t/502-bad-gateway/243606>\
**Category:** NGINX\
**Created:** [December 9, 2015, 5:04pm UTC](https://www.ruby-forum.com/t/502-bad-gateway/243606 "2015-12-09T17:04:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [December 9, 2015, 5:04pm UTC](https://www.ruby-forum.com/t/502-bad-gateway/243606/1 "2015-12-09T17:04:37Z")

</div>

Hello,

I have a magento website working fine for months now.  
However i recently installed a PDF plugin to send invoices with emails.  
The PDF url is giving a 502 bad gateway  
“{admin}/sales\_invoice/view/invoice\_id/717/key/5650a40d93929f5db4383db2a169b08a/”.  
I have checked around on the internet and cant find the issue here. no  
APC. increased fastcgi buffers doesnt change anything. checked nginx  
logs, magento logs and user logs but nothing.

Could anyone point me in the right direction on how to figure this one  
out?

---

<div class="post-metadata">

**Author:** ![Christ-Jan\_Wijtmans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/82dd89/32.png) [@Christ-Jan\_Wijtmans](https://www.ruby-forum.com/u/Christ-Jan_Wijtmans)\
**Post date:** [December 9, 2015, 6:24pm UTC](https://www.ruby-forum.com/t/502-bad-gateway/243606/2 "2015-12-09T18:24:05Z")

</div>

Hello!

On Wed, Dec 09, 2015 at 05:03:56PM +0100, Christ-Jan Wijtmans wrote:

> Could anyone point me in the right direction on how to figure this one out?  
> If 502 is returned by nginx, this means that an error happened  
> while talking to an upstream server. Details about the error are  
> expected to be available in the error log at the “error” level. If  
> you don’t see error in the error log - this means that either  
> logging isn’t properly configured (or the error was returned by  
> the upstream server, not by nginx).

Details on how to configure logging can be found here:

> **[Core functionality](http://nginx.org/en/docs/ngx_core_module.html#error_log)**
>
> Configures logging. Several logs can be specified on the same configuration level (1.5.2). If on the main configuration level writing a log to a file is not explicitly defined, the default file will be used.

This article may be useful as well:

> **[A debugging log](http://nginx.org/en/docs/debugging_log.html)**

–  
Maxim D.

> **[nginx](http://nginx.org/)**

---

<div class="post-metadata">

**Author:** ![Christ-Jan\_Wijtmans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/82dd89/32.png) [@Christ-Jan\_Wijtmans](https://www.ruby-forum.com/u/Christ-Jan_Wijtmans)\
**Post date:** [December 10, 2015, 6:05pm UTC](https://www.ruby-forum.com/t/502-bad-gateway/243606/3 "2015-12-10T18:05:20Z")

</div>

Hello Maxim,

Thank you for the response. I was assuming the error\_log in the block  
was properly set up but apparently it was not. I finally got an error  
message “2015/12/10 18:02:13 [error] 30341#0: \*10 recv() failed (104:  
Connection reset by peer) while reading response header from  
upstream”. Probably php-fpm related? I will continue to dig around.
