MX Admin
From KlavoWiki
Jump to navigationJump to search
nginx /mxa/
enable /mxa/ location
To install my iRedMail Custom Administration Pages
vi /etc/nginx/sites-available/00-default-ssl.conf
Add the following line before any other includes.
include /etc/nginx/templates/mxa.tmpl;
add /mxa/ location
vi /etc/nginx/templates/mxa.tmpl
location ^~ /mxa/ {
alias /var/www/mxa/;
index index.php;
# Allow static assets for iredadmin custom
location /mxa/assets/ {
expires 30d;
access_log off;
}
# Block direct access to both app and vendor folders
# Using specific prefix locations is safer and more reliable than regex when using alias
location ^~ /mxa/app/ {
deny all;
}
location ^~ /mxa/vendor/ {
deny all;
}
# Only allow index.php to execute as PHP
location ~ \.php$ {
if ($fastcgi_script_name !~ "^/mxa/index\.php$") {
return 404;
}
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass 127.0.0.1:9999;
}
}
location = /mxa {
return 301 $scheme://$http_host/mxa/;
}
vi /etc/nginx/templates/hsts.tmpl
Remove the existing line and add:
add_header X-Frame-Options "SAMEORIGIN"; add_header X-Content-Type-Options "nosniff"; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
nginx web files
Download
mkdir /var/www/mxa/ wget -qO- https://klaverstyn.com.au/david/downloads/mxa-26.5.7-1.tar.gz | tar -xzC /var/www/mxa
Move config file
mkdir -p /etc/mxa cd /var/www/mxa/ mv config.php /etc/mxa/config.php chown root:www-data /etc/mxa/config.php chmod 640 /etc/mxa/config.php
qrcode support
# Download the portable executable
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --quiet
php -r "unlink('composer-setup.php');"
# Use the local file to install the library
php composer.phar require chillerlan/php-qrcode
# (Optional) Delete the tool when finished
rm composer.phar
Set Permissions
chown -R www-data:www-data /var/www/mxa chmod -R 750 /var/www/mxa
Test and Restart nginx
nginx -t systemctl restart nginx
Access /mxa/
https://mail.myserver.com/mxa/