1

Topic: internal server error

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: Debian 9
- 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.
====

Hi, Thank you for this great email server!

I have an issue after changing from Apache to nginx, when trying to access URL/ireadmin I get this error in my uwsgi redadmin.log

Nov 20 00:36:50 2018 - chdir(): No such file or directory [plugins/python/pyloader.c line 109]
ImportError: No module named iredadmin
Tue Nov 20 00:36:50 2018 - unable to load app 0 (mountpoint='REDACTEDHOSTNAME|/iredadmin') (callable not found or import error)
Tue Nov 20 00:36:50 2018 - --- no python application found, check your startup logs for errors ---
REDACTEDHOSTNAME [pid: 843|app: -1|req: -1/17] REDACTEDIP () {54 vars in 847 bytes} [Tue Nov 20 00:36:50 2018] GET /iredadmin/ => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

looking the iredadmin directory:
/opt/www/iredadmin/plugins# ls -lah
total 12K
dr-xr-xr-x  3 iredadmin iredadmin 4.0K Apr  4  2018 .
dr-xr-xr-x 11 iredadmin iredadmin 4.0K Nov 19 23:01 ..
dr-xr-xr-x  3 iredadmin iredadmin 4.0K Apr  4  2018 cluster_unban_ip
-r-xr-xr-x  1 iredadmin iredadmin    0 Apr  4  2018 __init__.py

UWSGI is runnning:
ps aux|grep uwsgi
mlmmj      598  0.0  0.4  56284 16756 ?        S    00:09   0:00 uwsgi -d --ini /opt/mlmmjadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/mlmmjadmin/mlmmjadmin.pid --log-syslog
mlmmj      734  0.0  0.2  56284 11916 ?        S    00:09   0:00 uwsgi
mlmmj      735  0.0  0.2  56284 11916 ?        S    00:09   0:00 uwsgi
mlmmj      736  0.0  0.2  56284 11916 ?        S    00:09   0:00 uwsgi
mlmmj      737  0.0  0.2  56284 11916 ?        S    00:09   0:00 uwsgi
mlmmj      738  0.0  0.2  56284 11916 ?        S    00:09   0:00 uwsgi
iredadm+   831  0.0  0.2  39804  8512 ?        S    00:09   0:00 /usr/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/iredadmin.ini --daemonize /var/log/uwsgi/app/iredadmin.log
iredadm+   842  0.0  0.2  49200 10100 ?        S    00:09   0:00 /usr/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/iredadmin.ini --daemonize /var/log/uwsgi/app/iredadmin.log
iredadm+   843  0.0  0.2  49200 10100 ?        S    00:09   0:00 /usr/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/iredadmin.ini --daemonize /var/log/uwsgi/app/iredadmin.log
root      2374  0.0  0.0  12736  2244 pts/0    S+   00:40   0:00 grep uwsgi

any help is much appreciated.

2

Re: internal server error

hamselv wrote:

I have an issue after changing from Apache to nginx

Is this iRedMail server a new installation? or you just replaced Apache by Nginx on an old iRedMail server?

hamselv wrote:

Nov 20 00:36:50 2018 - chdir(): No such file or directory [plugins/python/pyloader.c line 109]
ImportError: No module named iredadmin

First line means the directory specified in uwsgi config file (parameter 'chdir =') doesn't exist.

If chdir path is correct, second line means file owner/group and/or permission might be wrong. iRedAdmin config file "settings.py" must be owned by "iredadmin:iredadmin" with permission 0400.

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

3

Re: internal server error

ZhangHuangbin wrote:
hamselv wrote:

I have an issue after changing from Apache to nginx

Is this iRedMail server a new installation? or you just replaced Apache by Nginx on an old iRedMail server?

I replaced apache with nginx as I did not want to move users and mail data to a new server.

ZhangHuangbin wrote:
hamselv wrote:

Nov 20 00:36:50 2018 - chdir(): No such file or directory [plugins/python/pyloader.c line 109]
ImportError: No module named iredadmin

First line means the directory specified in uwsgi config file (parameter 'chdir =') doesn't exist.
If chdir path is correct, second line means file owner/group and/or permission might be wrong. iRedAdmin config file "settings.py" must be owned by "iredadmin:iredadmin" with permission 0400.

I will try this ..

4

Re: internal server error

now I get this in the log: /var/log/uwsgi/app/iredadmin.log


Sun Nov 25 16:02:50 2018 - *** no app loaded. going in full dynamic mode ***
Sun Nov 25 16:02:50 2018 - *** uWSGI is running in multiple interpreter mode ***
Sun Nov 25 16:02:50 2018 - spawned uWSGI master process (pid: 829)
Sun Nov 25 16:02:50 2018 - spawned uWSGI worker 1 (pid: 841, cores: 1)
Sun Nov 25 16:02:50 2018 - spawned uWSGI worker 2 (pid: 842, cores: 1)
Sun Nov 25 16:03:05 2018 - WSGI app 0 (mountpoint='FQDNRedacted|/iredadmin') ready in 0 seconds on interpreter 0xcf4830 pid: 841
ssl.webinc.dk [pid: 841|app: 0|req: 1/1] 77.68.250.85 () {54 vars in 947 bytes} [Sun Nov 25 16:03:05 2018] GET /iredadmin//iredadmin/ => generated 0 bytes in 148 msecs (HTTP/1.1 303) 3 headers in 206 bytes (2 switches on core 0)
ssl.webinc.dk [pid: 841|app: 0|req: 2/2] 77.68.250.85 () {54 vars in 974 bytes} [Sun Nov 25 16:03:05 2018] GET /iredadmin//iredadmin/iredadmin => generated 9 bytes in 30 msecs (HTTP/1.1 404) 2 headers in 153 bytes (2 switches on core 0)
ssl.webinc.dk [pid: 841|app: 0|req: 3/3] 77.68.250.85 () {54 vars in 962 bytes} [Sun Nov 25 16:03:11 2018] GET /iredadmin//iredadmin/login => generated 9 bytes in 4 msecs (HTTP/1.1 404) 2 headers in 153 bytes (2 switches on core 0)
ssl.webinc.dk [pid: 841|app: 0|req: 4/4] 77.68.250.85 () {56 vars in 1051 bytes} [Sun Nov 25 17:24:12 2018] GET /iredadmin//iredadmin/login => generated 9 bytes in 8 msecs (HTTP/1.1 404) 2 headers in 153 bytes (2 switches on core 0)

but the going to the URL in the browser gives me: "not found"

5

Re: internal server error

hamselv wrote:

I replaced apache with nginx as I did not want to move users and mail data to a new server.

If you replaced Nginx by Apache, you should run Apache + mod_wsgi to run iRedAdmin, instead of running uwsgi.

- Do you have apache module 'mod_wsgi' enabled?
- Do you have apache config file for iRedAdmin?

Btw, why not Nginx?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

6

Re: internal server error

ZhangHuangbin wrote:

Btw, why not Nginx?

It is - it was Apache so the original configuration of iredmail was done with Apache not Nginx - could this be the issue?

7

Re: internal server error

Please show me your full uwsgi config file for iredadmin app.

In upcoming iRedMail-0.9.9, iRedAdmin(-Pro) will become a standalone daemon service (ran with uwsgi command).

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

8

Re: internal server error

ZhangHuangbin wrote:

Please show me your full uwsgi config file for iredadmin app.

In upcoming iRedMail-0.9.9, iRedAdmin(-Pro) will become a standalone daemon service (ran with uwsgi command).

cat /etc/uwsgi/apps-enabled/iredadmin.ini
[uwsgi]
plugins = python
vhost = true
socket = /var/run/uwsgi_iredadmin.socket
#pidfile = /var/run/uwsgi_iredadmin.pid
chown-socket = iredadmin:iredadmin
chmod-socket = 660
uid = iredadmin
gid = iredadmin
enable-threads = true

9

Re: internal server error

Is it possible to give me direct ssh access with root privilege for troubleshooting? contact me: zhb _at_ iredmail _dot_ org

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

10 (edited by hamselv 2018-12-06 14:29:56)

Re: internal server error

ZhangHuangbin wrote:

Is it possible to give me direct ssh access with root privilege for troubleshooting? contact me: zhb _at_ iredmail _dot_ org

I think the best would be to start a new server and reinstall from scratch - then migrate users and mail

Ps. I just tried to start apache again and there everything works (still) thought the new iredadmin-pro wouldn't work under apache..

11

Re: internal server error

hamselv wrote:

thought the new iredadmin-pro wouldn't work under apache..

Did you upgrade libapache2-mod-wsgi?
There's another forum topic with similar issue, i guess there's a bug in libapache2-mod-wsgi. You can try to downgrade it and try again.

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee