1 (edited by sloog 2019-05-24 21:05:42)

Topic: iRedAdmin bad gateway 502 error.

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

I am having the same problem as many other folk. I can't load the /iredadmin/ url. I see the following errors in the logs:

2019/05/24 12:17:14 [error] 1144#1144: *91 upstream prematurely closed connection while reading response header from upstream, client: 42.215.97.75, server: _, request: "GET /iredadmin/ HTTP/1.1", upstream: "uwsgi://127.0.0.1:7791", host: "MUNGED"
2019/05/24 12:25:21 [error] 1144#1144: *132 upstream prematurely closed connection while reading response header from upstream, client: 42.215.97.75, server: _, request: "GET /iredadmin/ HTTP/1.1", upstream: "uwsgi://127.0.0.1:7791", host: "MUNGED"

uwsgi is running (many times?)

$ ps -fe | grep uwsgi
mlmmj      998     1  0 12:26 ?        00:00:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj     1255   998  0 12:26 ?        00:00:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj     1256   998  0 12:26 ?        00:00:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj     1257   998  0 12:26 ?        00:00:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj     1258   998  0 12:26 ?        00:00:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj     1259   998  0 12:26 ?        00:00:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid


$ telnet 0 7790
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.

This only affects the /iredadmin/ url, everything else works fine. This worked at initial install, but after upgrade to 0.9.9, it stopped working. I see lots of other posts about this, but no actual solutions.

It's also worth noting that I don't know why nginx is attempting to connect to something on port 7791 because there is nothing listening there. But I can't find the nginx template for the /iredamin/ URL to see what it is being told to do with those requests.

Also, I don't see an iredadmin service running and no such service file in the /etc/init.d directory so I am not sure if that is the problem. I did not check this all out before upgrading.

What am I missing?


EDIT: I found the nginx template for /iredadmin/ and changed the following line to port 7790 to reflect the port uwsgi is actually running on. I have no clue why it was set to 7791, but it still does not resolve the problem:

/etc/nginx/templates/iredadmin.tmpl

----

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

2

Re: iRedAdmin bad gateway 502 error.

On my running config      $ ps -fe | grep uwsgi     reports processes like yours for   "mlmmj"   plus those processes

iredadm+  3686  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3687  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3691  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3692  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3694  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid

It looks like you have some missing pocesses running there..

3

Re: iRedAdmin bad gateway 502 error.

marcostr wrote:

On my running config      $ ps -fe | grep uwsgi     reports processes like yours for   "mlmmj"   plus those processes

iredadm+  3686  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3687  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3691  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3692  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3694  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid

It looks like you have some missing pocesses running there..

Interesting, thanks. What version are you running? I ask because this path does not exist in my 0.9:

/opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini

But it does in 0.9.6.

# ls -l 
total 12
lrwxrwxrwx  1 root      root        13 May 22 11:16 iredadmin -> iRedAdmin-0.9
dr-xr-xr-x 10 iredadmin iredadmin 4096 May 22 12:01 iRedAdmin-0.9
dr-xr-xr-x 11 iredadmin iredadmin 4096 May 22 11:01 iRedAdmin-0.9.6
lrwxrwxrwx  1 root      root        28 May 22 10:52 roundcubemail -> /opt/www/roundcubemail-1.3.8
drwxr-xr-x 13 root      root      4096 May 22 10:52 roundcubemail-1.3.8

# pwd
/opt/www
# find . -name *uwsgi*
./iRedAdmin-0.9.6/rc_scripts/uwsgi
# 

But it is kind of confusing why the version in /etc/iredmail-release is 0.9.9, but the folder directory is just 0.9. I installed 0.9.6 and upgraded to 0.9.9 so I would expect the directory to be named iRedAdmin-0.9.9, but it is just iRedAdmin-0.9.

So I am curious if you're running 0.9.6 or 0.9(.9)?

4

Re: iRedAdmin bad gateway 502 error.

By rolling my symlink back to 0.9.6, the admin comes back up. And the process owners change to look more like yours, so I assume you're running 0.9.6.

I guess I will hold off updating to 0.9.9 iRedAdmin to 0.9 until this problem is fixed:

$ sudo ls -l /opt/www/
total 20
drwxr-xr-x  5 root      root      4096 May 24 16:58 .
drwxr-xr-x  6 root      root      4096 May 24 12:25 ..
lrwxrwxrwx  1 root      root        15 May 24 16:58 iredadmin -> iRedAdmin-0.9.6
dr-xr-xr-x 10 iredadmin iredadmin 4096 May 24 16:15 iRedAdmin-0.9
dr-xr-xr-x 11 iredadmin iredadmin 4096 May 22 11:01 iRedAdmin-0.9.6
lrwxrwxrwx  1 root      root        28 May 22 10:52 roundcubemail -> /opt/www/roundcubemail-1.3.8
drwxr-xr-x 13 root      root      4096 May 22 10:52 roundcubemail-1.3.8

$ ps -ef | grep uwsgi
iredadm+  1013     1  0 16:59 ?        00:00:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  1269  1013  0 16:59 ?        00:00:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  1270  1013  0 16:59 ?        00:00:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  1271  1013  0 16:59 ?        00:00:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  1272  1013  0 16:59 ?        00:00:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  1279  1013  0 16:59 ?        00:00:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
sloog wrote:
marcostr wrote:

On my running config      $ ps -fe | grep uwsgi     reports processes like yours for   "mlmmj"   plus those processes

iredadm+  3686  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3687  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3691  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3692  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+  3694  3296  0 mag23 ?        00:00:00 /usr/sbin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid

It looks like you have some missing pocesses running there..

Interesting, thanks. What version are you running? I ask because this path does not exist in my 0.9:

/opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini

But it does in 0.9.6.

# ls -l 
total 12
lrwxrwxrwx  1 root      root        13 May 22 11:16 iredadmin -> iRedAdmin-0.9
dr-xr-xr-x 10 iredadmin iredadmin 4096 May 22 12:01 iRedAdmin-0.9
dr-xr-xr-x 11 iredadmin iredadmin 4096 May 22 11:01 iRedAdmin-0.9.6
lrwxrwxrwx  1 root      root        28 May 22 10:52 roundcubemail -> /opt/www/roundcubemail-1.3.8
drwxr-xr-x 13 root      root      4096 May 22 10:52 roundcubemail-1.3.8

# pwd
/opt/www
# find . -name *uwsgi*
./iRedAdmin-0.9.6/rc_scripts/uwsgi
# 

But it is kind of confusing why the version in /etc/iredmail-release is 0.9.9, but the folder directory is just 0.9. I installed 0.9.6 and upgraded to 0.9.9 so I would expect the directory to be named iRedAdmin-0.9.9, but it is just iRedAdmin-0.9.

So I am curious if you're running 0.9.6 or 0.9(.9)?

5 (edited by marcostr 2019-05-25 01:36:09)

Re: iRedAdmin bad gateway 502 error.

sloog wrote:

Interesting, thanks. What version are you running? I ask because this path does not exist in my 0.9:

/opt/www/iredadmin/rc_scripts/uwsgi/rhel.ini

OS:  CentOS 7
iredmail: v. 0.9.9
iRedAdmin v. 0.9.6

I'm quite a newbie with this amazing iRedMail, it was installed a couple of week ago as downloaded frome the site.
no other updates applied yet.

6

Re: iRedAdmin bad gateway 502 error.

Please restart "iredadmin" service and try again.