1

Topic: v1.3 安装 iRedMail pro 问题

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): v1.3
- Deployed with iRedMail Easy or the downloadable installer? dowload installer
- Linux/BSD distribution name and version: ubuntu 20.04 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
我安装新系统 ubuntu 20.04, 然后安装 iRedMail v1.3, 检查连接iRedadmin 正常, 再装上iRedmail Pro 就出这问题。
用户连接web mail 可以, 但是不能连接 iRedadmin 了。显示 "404 Not Found nginx".
请问是什么问题?

----

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

2

Re: v1.3 安装 iRedMail pro 问题

是否自行安装了 let’s encrypt 的 ssl 证书?

3

Re: v1.3 安装 iRedMail pro 问题

ZhangHuangbin wrote:

是否自行安装了 let’s encrypt 的 ssl 证书?

你好!
我刚刚从新安装检查了一次, 还是一样问题,没看到步骤叫选着 let’s encrypt 的 ssl 证书。
完全新的一台看到的问题。

4

Re: v1.3 安装 iRedMail pro 问题

/opt/www/ 目录下有 iRedAdmin 或 iRedAdmin-Pro 的目录吗?

5

Re: v1.3 安装 iRedMail pro 问题

有啊
有五个文件夹。
iredadmin  iRedAdmin-1.0  iRedAdmin-Pro-SQL-4.4  roundcubemail  roundcubemail-1.4.6

6

Re: v1.3 安装 iRedMail pro 问题

是否有修改过 /etc/nginx/sites-enabled/ 或 /etc/nginx/sites-available/ 目录下的文件?

7

Re: v1.3 安装 iRedMail pro 问题

没修改过, 我都下载最新ubuntu SV 系统及最新iRedMAIL 来测试的。

8

Re: v1.3 安装 iRedMail pro 问题

我刚刚有从新装测试, 一样问题, “upgrade iRedAdmin pro 的显示”, 请看看,就是更新pro 版本就不能连进 web iRedAdmin.

root@mail:~/iRedAdmin-Pro-SQL-4.4/tools# bash upgrade_iredadmin.sh
* Detected Linux/BSD distribution: UBUNTU
* HTTP server root: /opt/www
* Found iRedAdmin directory: /opt/www/iredadmin, symbol link of /opt/www/iRedAdm                                                                                        in-1.0
* Found iRedAdmin config file: /opt/www/iredadmin/settings.py
* Copying new version to /opt/www/iRedAdmin-Pro-SQL-4.4
* Copy /opt/www/iredadmin/settings.py.
* Remove existing systemd service files.
* Copy systemd service file: /lib/systemd/system/iredadmin.service.
* Removing old symbol link /opt/www/iredadmin
* Creating symbol link /opt/www/iredadmin to /opt/www/iRedAdmin-Pro-SQL-4.4
* Delete all existing sessions to force all admins to re-login.
* Enable mlmmj integration.
* Restarting service: mlmmjadmin.
* Check and install dependent Python modules:
  + [required] json or simplejson
  + [required] dnspython
  + [required] pycurl
  + [required] requests
* Check SQL tables, and add missed ones - if there's any
* Clean up.
* iRedAdmin has been successfully upgraded.
* Restarting iredadmin service.
* Enable service: iredadmin
Created symlink /etc/systemd/system/multi-user.target.wants/iredadmin.service ->                                                                                         /lib/systemd/system/iredadmin.service.
* Upgrading completed.
<<< NOTE >>> If iRedAdmin doesn't work as expected, please post your issue in
<<< NOTE >>> our online support forum: http://www.iredmail.org/forum/
root@mail:~/iRedAdmin-Pro-SQL-4.4/tools#

9

Re: v1.3 安装 iRedMail pro 问题

麻烦贴一下 /etc/nginx/templates/iredadmin.tmpl 文件的内容。

10

Re: v1.3 安装 iRedMail pro 问题

/etc/nginx/templates/iredadmin.tmpl 文件的内容

# Settings for iRedAdmin.

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

# Python scripts
location ~ ^/iredadmin(.*) {
    rewrite ^/iredadmin(/.*)$ $1 break;

    include /etc/nginx/templates/hsts.tmpl;

    include uwsgi_params;
    uwsgi_pass 127.0.0.1:7791;
    uwsgi_param UWSGI_CHDIR /opt/www/iredadmin;
    uwsgi_param UWSGI_SCRIPT iredadmin;
    uwsgi_param SCRIPT_NAME /iredadmin;

    # Access control
    #allow 127.0.0.1;
    #allow 192.168.1.10;
    #allow 192.168.1.0/24;
    #deny all;
}

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

# Handle newsletter-style subscription/unsubscription supported in iRedAdmin-Pro.
location ~ ^/newsletter/ {
    rewrite /newsletter/(.*) /iredadmin/newsletter/$1 last;
}

11

Re: v1.3 安装 iRedMail pro 问题

/var/log/nginx/error.log  内容:

2020/07/06 08:20:48 [error] 933#933: *328 upstream prematurely closed connection while reading response header from upstream, client: 192.168.36.19, server: _, request: "GET /iredadmin HTTP/1.1", upstream: "uwsgi://127.0.0.1:7791", host: "xxxx.xxxx"
2020/07/06 08:23:31 [error] 889#889: *48 upstream prematurely closed connection while reading response header from upstream, client: 192.168.36.19, server: _, request: "GET /iredadmin HTTP/1.1", upstream: "uwsgi://127.0.0.1:7791", host: "xxxx.xxxx"
2020/07/06 08:23:37 [error] 889#889: *48 open() "/var/www/html/iRedAdm" failed (2: No such file or directory), client: 192.168.36.19, server: _, request: "GET /iRedAdm HTTP/1.1", host: "xxxx.xxxx"
2020/07/06 08:23:39 [error] 889#889: *48 open() "/var/www/html/iRedAdm" failed (2: No such file or directory), client: 192.168.36.19, server: _, request: "GET /iRedAdm HTTP/1.1", host: "xxxx.xxxx"
2020/07/06 08:30:06 [error] 889#889: *188 upstream prematurely closed connection while reading response header from upstream, client: 192.168.36.19, server: _, request: "GET /iredadmin HTTP/1.1", upstream: "uwsgi://127.0.0.1:7791", host: "xxxx.xxxx"

12

Re: v1.3 安装 iRedMail pro 问题

麻烦运行一下 "service iredadmin status" 命令,贴一下输出。

13

Re: v1.3 安装 iRedMail pro 问题

"service iredadmin status" 命令:

iredadmin.service - iRedAdmin daemon service
     Loaded: loaded (/lib/systemd/system/iredadmin.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-07-07 04:30:42 UTC; 2 days ago
   Main PID: 4389 (uwsgi)
      Tasks: 6 (limit: 18985)
     Memory: 3.3M
     CGroup: /system.slice/iredadmin.service
             ├─4389 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─4391 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─4392 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─4393 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─4394 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             └─4395 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid

Jul 07 04:30:42 mail iredadmin[4389]: !!!!!!!!!!! END OF WARNING !!!!!!!!!!
Jul 07 04:30:42 mail iredadmin[4389]: spawned uWSGI master process (pid: 4389)
Jul 07 04:30:42 mail iredadmin[4389]: spawned uWSGI worker 1 (pid: 4391, cores: 1)
Jul 07 04:30:42 mail iredadmin[4389]: spawned uWSGI worker 2 (pid: 4392, cores: 1)
Jul 07 04:30:42 mail iredadmin[4389]: spawned uWSGI worker 3 (pid: 4393, cores: 1)
Jul 07 04:30:42 mail iredadmin[4389]: spawned uWSGI worker 4 (pid: 4394, cores: 1)
Jul 07 04:30:42 mail iredadmin[4389]: spawned uWSGI worker 5 (pid: 4395, cores: 1)
Jul 07 04:30:57 mail iredadmin[4389]: -- unavailable modifier requested: 0 --
Jul 07 04:31:07 mail iredadmin[4389]: -- unavailable modifier requested: 0 --
Jul 07 05:05:05 mail iredadmin[4389]: -- unavailable modifier requested: 0 --

14

Re: v1.3 安装 iRedMail pro 问题

- 麻烦贴一下 /etc/systemd/system/multi-user.target.want/iredadmin.service 的内容。
- 邮件联系我: zhb _at_ iredmail.org。可以通过 ssh 直接连接帮忙处理这个问题。

15

Re: v1.3 安装 iRedMail pro 问题

我星期6有从新装一次, iRedMAIL 升级到 1.3.1 了。装 iRedMail Pro 上去还是一样问题, 但是我不知道里面内容错误会不会一样。 我这台只安装来测试你们有出来的新版本何以,如果稳定我才更新真用的那台。所以不用麻烦你你连接维修了。谢谢!

先复制你看看/etc/systemd/system/multi-user.target.want/iredadmin.service 的内容:
[Unit]
Description=iRedAdmin daemon service
After=network.target local-fs.target remote-fs.target

[Service]
Type=simple
ExecStartPre=-/bin/mkdir -p /var/run/iredadmin
ExecStartPre=/bin/chown iredadmin:iredadmin /var/run/iredadmin
ExecStartPre=/bin/chmod 0755 /var/run/iredadmin
ExecStart=/usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
ExecStop=/usr/bin/uwsgi --stop /var/run/iredadmin/iredadmin.pid
ExecStopPost=/bin/rm -rf /var/run/iredadmin
KillSignal=SIGTERM
PrivateTmp=true

[Install]
WantedBy=multi-user.target

16

Re: v1.3 安装 iRedMail pro 问题

是不是两个 uwsgi 程序?

/usr/bin/uwsgi
/usr/local/bin/uwsgi

17

Re: v1.3 安装 iRedMail pro 问题

/usr/bin/uwsgi
uwsgi           uwsgi-core      uwsgi_python3   uwsgi_python38

/usr/local/bin/uwsgi
vi         view       vigpg      vigr       vim        vim.basic  vimdiff    vim.tiny   vimtutor   vipw       visudo

两个 uwsgi 程序,什么意思?

18

Re: v1.3 安装 iRedMail pro 问题

系统上是不是有这两个可执行程序/文件:

/usr/bin/uwsgi
/usr/local/bin/uwsgi

19

Re: v1.3 安装 iRedMail pro 问题

对啊, 两个路劲都有这文件。

20

Re: v1.3 安装 iRedMail pro 问题

iRedAdmin-Pro 要使用 /usr/bin/uwsgi(这个支持 python 2)。
运行 "service iredadmin restart" 之后立即运行 "service iredadmin status”,贴一下输出。

21

Re: v1.3 安装 iRedMail pro 问题

service iredadmin status
● iredadmin.service - iRedAdmin daemon service
     Loaded: loaded (/lib/systemd/system/iredadmin.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-07-14 06:42:14 UTC; 1min 32s ago
    Process: 292968 ExecStartPre=/bin/mkdir -p /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 292971 ExecStartPre=/bin/chown iredadmin:iredadmin /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 292982 ExecStartPre=/bin/chmod 0755 /var/run/iredadmin (code=exited, status=0/SUCCESS)
   Main PID: 292983 (uwsgi)
      Tasks: 6 (limit: 18985)
     Memory: 3.4M
     CGroup: /system.slice/iredadmin.service
             ├─292983 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─292984 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─292985 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─292986 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─292987 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             └─292988 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid

Jul 14 06:42:14 mail iredadmin[292983]: !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!
Jul 14 06:42:14 mail iredadmin[292983]: no request plugin is loaded, you will not be able to manage requests.
Jul 14 06:42:14 mail iredadmin[292983]: you may need to install the package for your language of choice, or simply load it with --plugin.
Jul 14 06:42:14 mail iredadmin[292983]: !!!!!!!!!!! END OF WARNING !!!!!!!!!!
Jul 14 06:42:14 mail iredadmin[292983]: spawned uWSGI master process (pid: 292983)
Jul 14 06:42:14 mail iredadmin[292983]: spawned uWSGI worker 1 (pid: 292984, cores: 1)
Jul 14 06:42:14 mail iredadmin[292983]: spawned uWSGI worker 2 (pid: 292985, cores: 1)
Jul 14 06:42:14 mail iredadmin[292983]: spawned uWSGI worker 3 (pid: 292986, cores: 1)
Jul 14 06:42:14 mail iredadmin[292983]: spawned uWSGI worker 4 (pid: 292987, cores: 1)
Jul 14 06:42:14 mail iredadmin[292983]: spawned uWSGI worker 5 (pid: 292988, cores: 1)

22

Re: v1.3 安装 iRedMail pro 问题

- Ubuntu 20.04 系统,请修改 /etc/systemd/system/multi-user.target.wants/iredadmin.service,将 /usr/bin/uwsgi 替换为 /usr/local/bin/uwsgi。
- 另外请打开 /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini,注释掉 "plugins" 一行(如果有的话)。

23

Re: v1.3 安装 iRedMail pro 问题

可以了, 谢谢!