1 (edited by artaxerxes99 2015-09-28 05:12:02)

Topic: 502 Bad Gateway (nginx) / uwsgi will not start

Fresh install of CentOS 7.  Fresh install of iRedMail 0.9.2.  Firewall rules were not applied correctly by the iRedMail installer, but I fixed that by adding the required services manually like this:

firewall-cmd --permanent --add-service=https
firewall-cmd --permanent --add-service=imaps
firewall-cmd --permanent --add-service=smtp

Roundcube works fine.  Cannot access iRedMail web interface.  Get 502 Bad Gateway error because uwsgi is not running.  Reboot does not help.  Try to start manually and it fails, like this:

[root@sf ~]# service uwsgi start
Redirecting to /bin/systemctl start  uwsgi.service
[root@sf ~]# service uwsgi status -l
Redirecting to /bin/systemctl status  -l uwsgi.service
uwsgi.service - uWSGI Emperor Service
   Loaded: loaded (/usr/lib/systemd/system/uwsgi.service; enabled)
   Active: failed (Result: start-limit) since Sun 2015-09-27 05:32:33 UTC; 2s ago
  Process: 4166 ExecStart=/usr/sbin/uwsgi --ini /etc/uwsgi.ini (code=exited, status=0/SUCCESS)
  Process: 4163 ExecStartPre=/bin/chown uwsgi:uwsgi /run/uwsgi (code=exited, status=0/SUCCESS)
  Process: 4162 ExecStartPre=/bin/mkdir -p /run/uwsgi (code=exited, status=0/SUCCESS)
 Main PID: 4166 (code=exited, status=0/SUCCESS)
   Status: "initializing uWSGI"

Sep 27 05:32:33 <edited> systemd[1]: Started uWSGI Emperor Service.
Sep 27 05:32:33 <edited> systemd[1]: uwsgi.service holdoff time over, scheduling restart.
Sep 27 05:32:33 <edited> systemd[1]: Stopping uWSGI Emperor Service...
Sep 27 05:32:33 <edited> systemd[1]: Starting uWSGI Emperor Service...
Sep 27 05:32:33 <edited> systemd[1]: uwsgi.service start request repeated too quickly, refusing to start.
Sep 27 05:32:33 <edited> systemd[1]: Failed to start uWSGI Emperor Service.
Sep 27 05:32:33 <edited> systemd[1]: Unit uwsgi.service entered failed state.

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.2
- Linux/BSD distribution name and version: CentOS 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue: N/A
====

Thanks,
artaxerxes99

----

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

2

Re: 502 Bad Gateway (nginx) / uwsgi will not start

It's running Python 2.7.5.  Is this too old?

3

Re: 502 Bad Gateway (nginx) / uwsgi will not start

You might have the same issue I reported here: http://www.iredmail.org/forum/topic9924 … eport.html

uwsgi is not starting because it's missing the Jinja2 module for python. Try installing that.

4

Re: 502 Bad Gateway (nginx) / uwsgi will not start

corv wrote:

You might have the same issue I reported... uwsgi is not starting because it's missing the Jinja2 module for python. Try installing that.

Thanks for your suggestion.  I downloaded Jinja2-2.8.tar.gz from https://pypi.python.org/pypi/Jinja2#downloads and then installed Jinja:

tar -xzf Jinja2-2.8.tar.gz
cd Jinja2-2.8
python setup.py install

It installed successfully.  I rebooted the server, and then tried to run "service uwsgi start" again.  No change in results from the original post.  uwsgi is not able to start.

Result: Not fixed.  I still get 502 Bad Gateway when trying to open the iRedMail web app.

I then upgraded Python from 2.7.5 to 2.7.9 following the instructions at http://mythinkpond.com/2011/12/28/how-t … on-centos/.  This still did not make any difference.

5

Re: 502 Bad Gateway (nginx) / uwsgi will not start

Well, I gave up on CentOS and started over with Debian 8.1.  Installed iRedMail according to the instructions and everything just worked.  Annoying but true.

6

Re: 502 Bad Gateway (nginx) / uwsgi will not start

It's a bug in iRedMail sample config file: /etc/uwsgi.ini. We should comment out (or remove) 'daemonize =' line on RHEL/CentOS 7, but it's required on CentOS 6.

You can give it a try if you want to. Sorry about this trouble.