1

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.

2

Re: Apache wsgi proxy for iRedAdmin service

rob.ired wrote:

AND... my Apache restart (or stop) used to take minutes to occur.  Now it is instant.  Yippee !!

I don't believe iRedAdmin-Pro causes the long delay of restart/stop sad

by the way, you can continue running Apache + iRedAdmin-Pro without the uwsgi, just using old Apache configuration. but it's up to you since you have choices. smile

3

Re: Apache wsgi proxy for iRedAdmin service

ZhangHuangbin wrote:

I don't believe iRedAdmin-Pro causes the long delay of restart/stop sad

You are correct.  I inadvertently used

systemctl reload httpd

when I thought I used

systemctl restart httpd

In this case it made no difference to the result of my instructions.


ZhangHuangbin wrote:

you can continue running Apache + iRedAdmin-Pro without the uwsgi, just using old Apache configuration. but it's up to you since you have choices. smile

Yes I agree, however it seemed that there was no useful point in running it as a service (since 0.9.2) and also still having it run under mod_wsgi.

I posted because I thought it was not clear in the upgrade instructions that Apache users (legacy iRedMail installations) needed to update their config to take advantage of the new service (if they choose to).
So perhaps you could make an additional note in the upgrade instructions for Apache users; or link to this thread.

Thanks, Rob.