1 (edited by Ange7 2021-06-07 15:18:02)

Topic: [solved] uwsgi not working so iredadmin not working

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.4
- Deployed with iRedMail Easy or the downloadable installer? /
- Linux/BSD distribution name and version: Debian 9.0
- 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 have a problem with uwsgi,

my nginx configuration :

location /iredadmin {
        # iRedAdmin: static files under /iredadmin/static
        location ~ ^/iredadmin/static/(.*) {
            alias /opt/www/iredadmin/static/$1;
        }

        # iRedAdmin: Python scripts
        location ~ ^/iredadmin(.*) {
        root /usr/share/nginx/html;

            rewrite ^/iredadmin(/.*)$ $1 break;
            include uwsgi_params;
            # uwsgi_pass unix:/var/run/uwsgi_iredadmin.socket;
            # uwsgi_pass unix:///var/run/uwsgi_iredadmin.socket;
        uwsgi_pass unix:/var/run/uwsgi/app/uwsgi_iredadmin/socket;
            uwsgi_param UWSGI_CHDIR /opt/www/iredadmin;
            uwsgi_param UWSGI_SCRIPT iredadmin;
            uwsgi_param SCRIPT_NAME /iredadmin;
            }

        # iRedAdmin: redirect /iredadmin to /iredadmin/
        location = /iredadmin {
            rewrite ^ /iredadmin/;
        }
    }

/etc/uwsgi/apps-enabled/uwsgi_iredadmin.ini file :

[uwsgi_iredadmin]
plugins = python,syslog
master = true
vhost = true
enable-threads = true
processes = 5
logger = syslog:uwsgi,local5

uwsgi-socket = /var/run/uwsgi_iredadmin.socket

uid = www-data
gid = www-data

chdir = /opt/www/iredadmin
wsgi-file = iredadmin.py

But /var/run/uwsgi_iredadmin.socket file doesn't exists.

But i have this file : /var/run/uwsgi/app/uwsgi_iredadmin/socket

But when i use it in nginx configuration, i have this error :

upstream prematurely closed connection while reading response header from upstream
$ ps aux | grep uwsgi
iredadm+   473  0.0  0.2 126392 17488 ?        Ss    2020  16:50 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
mlmmj      479  0.0  0.1 113524 14888 ?        Ss    2020  16:39 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj      731  0.0  0.1 113524 10012 ?        S     2020   0:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj      732  0.0  0.1 113524 10012 ?        S     2020   0:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj      733  0.0  0.1 113524 10012 ?        S     2020   0:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj      734  0.0  0.1 113524 10012 ?        S     2020   0:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
mlmmj      735  0.0  0.1 113524 10012 ?        S     2020   0:00 /usr/bin/uwsgi --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid
iredadm+   748  0.0  0.1 126392 12880 ?        S     2020   0:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+   749  0.0  0.1 126392 12880 ?        S     2020   0:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+   751  0.0  0.1 126392 12880 ?        S     2020   0:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+   752  0.0  0.1 126392 12880 ?        S     2020   0:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
iredadm+   754  0.0  0.1 126392 12880 ?        S     2020   0:00 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
www-data 28276  0.0  0.0  93180  3920 ?        S    13:55   0:00 /usr/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/uwsgi_iredadmin.ini --daemonize /var/log/uwsgi/app/uwsgi_iredadmin.log
www-data 28278  0.0  0.0  93180   920 ?        S    13:55   0:00 /usr/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/uwsgi_iredadmin.ini --daemonize /var/log/uwsgi/app/uwsgi_iredadmin.log
www-data 28279  0.0  0.0  93180   920 ?        S    13:55   0:00 /usr/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/uwsgi_iredadmin.ini --daemonize /var/log/uwsgi/app/uwsgi_iredadmin.log

How can i fix it ?

Thank you.

----

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

2

Re: [solved] uwsgi not working so iredadmin not working

We don't use /etc/uwsgi/apps-enabled/uwsgi_iredadmin.ini anymore.

Ange7 wrote:

iredadm+   473  0.0  0.2 126392 17488 ?        Ss    2020  16:50 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid

Seems iredadmin is running. Any error when you access it with web browser?

3 (edited by Ange7 2021-05-25 20:21:47)

Re: [solved] uwsgi not working so iredadmin not working

502 Nginx Error
502 - Bad Gateway

2021/05/25 14:21:27 [error] 12069#12069: *285773 upstream prematurely closed connection while reading response header from upstream, client: 87.231.183.29, server: devnco.fr, request: "GET /iredadmin/ HTTP/1.1", upstream: "uwsgi://unix:/var/run/uwsgi/app/uwsgi_iredadmin/socket:", host: "devnco.fr"

4

Re: [solved] uwsgi not working so iredadmin not working

Ange7 wrote:

        uwsgi_pass unix:/var/run/uwsgi/app/uwsgi_iredadmin/socket;

You modified nginx config file and uses WRONG uwsgi socket path.

5

Re: [solved] uwsgi not working so iredadmin not working

ZhangHuangbin wrote:
Ange7 wrote:

        uwsgi_pass unix:/var/run/uwsgi/app/uwsgi_iredadmin/socket;

You modified nginx config file and uses WRONG uwsgi socket path.

it seems the right path ?

root! vm:/var/run/uwsgi/app/uwsgi_iredadmin# ll
total 4
-rw-r--r-- 1 root     root     6 mai   10 13:55 pid
srw-rw---- 1 www-data www-data 0 mai   10 13:55 socket

what is the right path ?

6

Re: [solved] uwsgi not working so iredadmin not working

Use "uwsgi_pass 127.0.0.1:7791;" instead, not a socket path.

7

Re: [solved] uwsgi not working so iredadmin not working

ZhangHuangbin wrote:

uwsgi_pass 127.0.0.1:7791;

Thank you !
Working great !