1

Topic: 0.9.9 Roundcube - 502 Bad Gateway - upstream prematurely closed

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? I curled tar
- Linux/BSD distribution name and version: FreeBSD 12.0-RELEASE
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Neh
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi, I just freshly installed iRedMail 0.9.9 in iocage jail. Everything works, but Roundcube.
When I try to access https://mail.domain.eml/mail Nginx returns 502 Bad Gateway and puts this in the error log:

2019/01/03 05:58:12 [error] 31374#100516: *11 upstream prematurely closed connection while reading response header from upstream, client: xxx.yyy.zzz.111, server: _, request: "GET /mail/ HTTP/1.1", upstream: "fastcgi://192.168.8.36:9999", host: "mail.domain.eml"

I checked /usr/local/etc/php-fpm.d/www.conf and added the 192.168.8.36 ip to listen.allowed_clients, but without any luck.

listen = 192.168.8.36:9999
listen.owner = www
listen.group = www
listen.mode = 0660
listen.allowed_clients = 127.0.0.1, 192.168.8.36

There is no log in: /usr/local/www/roundcube/logs

It seems that php-fpm.log does not record anything either:

Jan  3 05:31:20 mail php-fpm[31063]: [NOTICE] ready to handle connections
Jan  3 05:47:52 mail php-fpm[31338]: [NOTICE] configuration file /usr/local/etc/php-fpm.conf test is successful
Jan  3 05:47:52 mail php-fpm[31063]: [NOTICE] Finishing ...
Jan  3 05:47:52 mail php-fpm[31063]: [NOTICE] exiting, bye-bye!
Jan  3 05:47:52 mail php-fpm[31347]: [NOTICE] configuration file /usr/local/etc/php-fpm.conf test is successful
Jan  3 05:47:52 mail php-fpm[31349]: [NOTICE] fpm is running, pid 31349
Jan  3 05:47:52 mail php-fpm[31349]: [NOTICE] ready to handle connections


Do you have any other tips?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: 0.9.9 Roundcube - 502 Bad Gateway - upstream prematurely closed

Hi

Yes. Same here. FreeBSD 11.2 RELEASE, no jail. Restarting services useless. Problem only resolve when i restart the server. But it's happening again in 24 hours.

Best Regards.

Hasan Alp İNAN

3

Re: 0.9.9 Roundcube - 502 Bad Gateway - upstream prematurely closed

Try to increase settings in /usr/local/etc/php-fpm.conf, restart php-fpm service and try again:

pm.max_children = 100
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 100

4 (edited by hainan 2019-01-07 15:36:50)

Re: 0.9.9 Roundcube - 502 Bad Gateway - upstream prematurely closed

Hi

I found the settings you gave us above in www.conf file under /usr/local/etc/php-fpm.d/ directory tree. I applied new settings and started monitoring the server. Until now server running without a problem.

/usr/local/etc/php-fpm.d/www.conf

5

Re: 0.9.9 Roundcube - 502 Bad Gateway - upstream prematurely closed

Damn the error was so small.

The issue really lies on this line:

listen.allowed_clients = 127.0.0.1, 192.168.8.36

IPs can't have space in between, just a coma.

listen.allowed_clients = 127.0.0.1,192.168.8.36

So I removed the space after the comma and it is worky worky now.

Thank you all for your help

6

Re: 0.9.9 Roundcube - 502 Bad Gateway - upstream prematurely closed

aida wrote:

IPs can't have space in between, just a coma.

Thanks for sharing. i added a comment line in www.conf.