0

I am trying to install iredmail with apache. but now i have a problem i can serve only python file of iredadmin or static files. I need to make both of them working.

<Location "iredadmin/static">
    Order allow,deny
    Allow from all
    Require all granted
    Alias "/opt/www/iredadmin/static"
</Location>
Alias "/iredadmin/static" "/opt/www/iredadmin/static"
<Directory "iredadmin/static">
    allow from all
    Order allow,deny
    Options Indexes
    Require all granted
</Directory>


<Location "/iredadmin">
    RewriteEngine On
    RewriteRule ^/iredadmin(/.*)$ $l [L]    

    ProxyPreserveHost     On
    ProxyPass  "uwsgi://127.0.0.1:7791"
    ProxyPassReverse "uwsgi://127.0.0.1:7791"
</Location>

I have tried to replace the structure /iredadmin by /iredadmin/static. Also tried <LocationMatch "^\/iredadmin(?!\/static)(.*)"> isntead of <Location "/iredadmin"> but still facing the issue. I can disable the proxy and can see static files alone. or keep both and see only the proxy.

1 Answer 1

1

You have convoluted it quite a lot, go simple..

Location should be used for virtual paths only, Order,Allow, Deny should not be used nowadays in 2024 and even less mixing it with Require (2.4.x directive), those are deprecated from the 2.2.x days. Mixing them you can get opposite unexpected results.

Alias is fine, but directory should point to real directory path. And also you do not need so much "" everywhere.

It is better to not mix Location and ProxyPass unless you are very sure of what you are doing, as they are interepreted in opposite order and ProxyPass can already specify the path to proxy, so why embed it in Location? Location can be used to specify configurations that only affect the mentioned path being used in proxypass. Like, for example in case you add another proxy directives to a different backend but you do not want to preserve the host on the second backend, you can specify the location in which you want proxypreservehost and it will affect just that path.

Also try to always match trailing slashes.

Alias /iredadmin/static /opt/www/iredadmin/static
<Directory /opt/www/iredadmin/static>
    Options Indexes # This is for directory listing, chances are you dont need it
    Require all granted
</Directory>

# RedirectMatch ^/iredadmin /iredadmin/  # optional
ProxyPreserveHost     On
ProxyPass /iredadmin/static !  # this will make it to not proxy this path
ProxyPass /iredadmin/ uwsgi://127.0.0.1:7791/
ProxyPassReverse /iredadmin/ uwsgi://127.0.0.1:7791/
2
  • thanks your answer is really helpful, but i faced another issue, the session is not longer than a minute. Commented May 26 at 11:16
  • adjust timeout, check error logs Commented May 26 at 11:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .