1 (edited by elfoiros 2015-05-29 18:44:30)

Topic: nginx error 502 Bad gateway

Hi,

i'm facing an issue with nginx. I got a 502 Bad gateway nginx error when trying to access to https://my-domain/iredadmin/

The file /var/run/uwsgi_iredadmin.socket don't exist. See nginx error.log bellow

2015/05/29 08:55:04 [crit] 4054#0: *119 connect() to unix:/var/run/uwsgi_iredadmin.socket failed (2: No such file or directory) while connecting to upstream, client: x.x.x.x, server: _, request: "GET /iredadmin/ HTTP/1.1", upstream: "uwsgi://unix:/var/run/uwsgi_iredadmin.socket:", host: "xxxxxxxxxx"

PS: service uwsgi status => uwsgi is running

i've installed iRedmail with : bash -x iRedMail.sh 2>&1
In the terminal output i can see this :

+++ export IREDADMIN_HTTPD_CONF=/iredadmin.conf
+++ IREDADMIN_HTTPD_CONF=/iredadmin.conf

and we have the same for CLUEBRINGER_HTTPD_CONF=/cluebringer.conf, and so on ...

After investigation :
[root@my-domain ~]# grep IREDADMIN_HTTPD_CONF /root/iRedMail-0.9.1 -R
/root/iRedMail-0.9.1/conf/iredadmin:export IREDADMIN_HTTPD_CONF="${HTTPD_CONF_DIR}/iredadmin.conf"

it means that the variable $HTTPD_CONF_DIR is equal to "" during install process. I'm using nginx web server not apache.

Could you please have a look ?

Thanks in advance.

-------------------------------------------------------------------------------------------------
- iRedMail version: 0.9.1
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL (MariaDB)
- Web server (Apache or Nginx): Nginx
- Linux/BSD distribution name and version: CentOS Linux release 7.1.1503 (Core)
- Related log if you're reporting an issue: /var/log/nginx/error.log
- Dedicated server (Not virtual machine)

----

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

2

Re: nginx error 502 Bad gateway

I have exactly the same problem with the iredmail version 0.9.1
Nginx worked for me, out of the box on 0.9.0

3

Re: nginx error 502 Bad gateway

Fixed on May 24:
https://bitbucket.org/zhb/iredmail/comm … 8ced51fecd

uwsgi service doesn't work on RHEL/CentOS. A new version of uwsgi
package was submitted to EPEL repo with higher priority (not
submitted by iRedMail team), it's not compatible with settings
configured by iRedMail, this causes uwsgi service cannot be started.

4

Re: nginx error 502 Bad gateway

I confirm it's fixed !

i used the last mercurial version : hg clone https://bitbucket.org/zhb/iredmail

Work like a charm.

Thanks you.

5 (edited by mir 2015-05-31 23:14:27)

Re: nginx error 502 Bad gateway

On Debian 8 (Jessie) I see this in /var/log/apache2/error.log:
/var/log/apache2/error.log:[Sun May 31 06:25:13.844751 2015] [wsgi:warn] [pid 28252] mod_wsgi: Compiled for Python/2.7.8.
/var/log/apache2/error.log:[Sun May 31 06:25:13.844780 2015] [wsgi:warn] [pid 28252] mod_wsgi: Runtime using Python/2.7.9.

Are these warnings related?

6

Re: nginx error 502 Bad gateway

Hi mir,

It means you're running Python 2.7,9, but the uwsgi package was built with Python 2.7.8.
You should upgrade uwsgi with 'apt-get' to fix this issue.

7

Re: nginx error 502 Bad gateway

ZhangHuangbin wrote:

Hi mir,

It means you're running Python 2.7,9, but the uwsgi package was built with Python 2.7.8.
You should upgrade uwsgi with 'apt-get' to fix this issue.

The server is fully upgraded so I guess this is a packaging error.

8

Re: nginx error 502 Bad gateway

Hi, I am having the same issue with 0.9.2. 

nginx reports:
015/06/24 20:31:19 [crit] 1317#0: *16 connect() to unix:/run/uwsgi/iredadmin.socket failed (2: No such file or directory) while connecting to upstream, client: xxxxx, server: _, request: "GET /iredadmin/ HTTP/1.1", upstream: "uwsgi://unix:/run/uwsgi/iredadmin.socket:", host: "host.domain.com"

uwsgi.log reports:
Wed Jun 24 20:28:06 2015 - *** Starting uWSGI 2.0.9 (64bit) on [Wed Jun 24 20:28:06 2015] ***
Wed Jun 24 20:28:06 2015 - compiled with version: 4.8.3 20140911 (Red Hat 4.8.3-9) on 23 April 2015 19:50:42
Wed Jun 24 20:28:06 2015 - os: Linux-2.6.32-042stab108.5 #1 SMP Wed Jun 17 20:20:17 MSK 2015
Wed Jun 24 20:28:06 2015 - nodename: host.domain.com
Wed Jun 24 20:28:06 2015 - machine: x86_64
Wed Jun 24 20:28:06 2015 - clock source: unix
Wed Jun 24 20:28:06 2015 - pcre jit disabled
Wed Jun 24 20:28:06 2015 - detected number of CPU cores: 8
Wed Jun 24 20:28:06 2015 - current working directory: /
Wed Jun 24 20:28:06 2015 - writing pidfile to /run/uwsgi/uwsgi.pid
Wed Jun 24 20:28:06 2015 - detected binary path: /usr/sbin/uwsgi
Wed Jun 24 20:28:06 2015 - uWSGI running as root, you can use --uid/--gid/--chroot options
Wed Jun 24 20:28:06 2015 - *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Wed Jun 24 20:28:06 2015 - your processes number limit is 255959

I looked at the latest commit referenced on this thread to see if I could figure out how to patch my version.  I had no luck with that. 

I am working from a Centos 7 VPS that is a clean image.  Any help would be appreciated.  Your product looks great in the demos but seems like uwsgi is really unstable.

Thanks,
David Sandor

9

Re: nginx error 502 Bad gateway

dsandor wrote:

connect() to unix:/run/uwsgi/iredadmin.socket failed (2: No such file or directory)

uwsgi service is not running, please run it first. If it cannot start, please show us /etc/uwsgi.ini.