Topic: Apache wsgi proxy for iRedAdmin service
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? No
- Linux/BSD distribution name and version: CentOS 7.7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache 2.4
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Today I upgraded to 0.9.9 and noticed the iRedAdmin in now a service listening on 7791.
This is nice.
Given I am using Apache, the upgrade process does not change the Apache config from mod_wsgi to mod_proxy_uwsgi
If you don't make the changes shown in this post:
iRedMail Support Post
Then you are still running iRedAdmin as a child process under Apache.
This does work, but the new iredadmin.service is not being used.
So after having discovered the answer elsewhere, I found the post above that was the same solution. Nice !!
This is what I did (with more detail):
Install the Apache Module from EPEL
yum install mod_proxy_uwsgi
Enable the new module
echo 'LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so' >> /etc/httpd/conf.modules.d/00-proxy.conf
Modify the default Apache iredadmin.conf file - /etc/httpd/conf.d/iredadmin.conf
Comment out the first 4 lines, leaving only the Directory section.
My last 2 lines above were already commented because they were moved to a vhost.
#WSGISocketPrefix /var/run/wsgi
#WSGIDaemonProcess iredadmin user=iredadmin threads=15
#WSGIProcessGroup iredadmin
#AddType text/html .py
<Directory /var/www/iredadmin/>
<IfVersion < 2.4>
Order deny,allow
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>
#Alias /iredadmin/static "/var/www/iredadmin/static/"
#WSGIScriptAlias /iredadmin "/var/www/iredadmin/iredadmin.py/"
In my vhost config file. (or you can put it in your /etc/httpd/conf.d/iredadmin.conf)
....
Alias /iredadmin/static "/var/www/iredadmin/static/"
ProxyPass /iredadmin/static !
ProxyPass /iredadmin "uwsgi://127.0.0.1:7791"
# WSGIScriptAlias /iredadmin "/var/www/iredadmin/iredadmin.py/"
....
Remove the old Apache Module
yum erase mod_wsgi
Restart Apache
systemctl reload httpd
Done.
AND... my Apache restart (or stop) used to take minutes to occur. Now it is instant. Yippee !!
Rob.
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.