504 Gateway Time-out when sending smtp mail via PHP even though mail arrives at destination

November 16, 2014 4.5k views

I have a weird problem on one of my LEMP droplets, while the same thing whith the same E-mail account and settings works fine on other droplets: when sending an E-mail via SMTP using PHP I get a "504 Gateway Time-out". But the E-mail is actually sent, and I tried completely different E-mail accounts which all had the same problem.

The error.log says this (for security reasons I changed the urls and IP here obviously):

2014/11/16 09:51:12 [error] 5666#0: *13 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 777.777.777.777, server: www.somedomain.de, request: "POST /ajax/shop/resend_order HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "www.somedomain.de", referrer: "http://www.somedomain.de/de/admin/list/orders"

The strange thing: because I could not remedy this, I started a new LEMP droplet and manually copied database and web space over there (I did not want to use an image to be sure I have a fresh installation and don't copy whatever I did wrong on the old one over to the new one). And everything worked fine again!

Still I'd like to know what caused this problem since I don't want to run into it again. I have the old droplet running, so I can throw any solution at it suggested here ;-)
I'm not a Linux expert, but I'm willing to learn!

Thanks in advance, Sebastian

1 comment
1 Answer

I have the same problem. Did you managed to solve it? Thanks in advance!

Have another answer? Share your knowledge.