Since this one is a little more complex to get; below, is the simplest way to always get the latest released version of PostfixAdmin. On page 2 I will explain these commands better; for now, here is the commands.

LATEST_PFA=$(curl -v 2> >(grep 'location:') >/dev/null | awk -F/ '{print ($NF)}')
LATEST_PFA=$(echo -n "${LATEST_PFA%$'\r'}")

Ok, now we have a url for the latest PostfixAdmin so we can follow LinuxBabe's Postfix Admin step with the path additions I have created above.

sudo apt install wget

wget $PFA_URL

Now that it is downloaded, now it is time to create the web directory and move the posfixadmin to this path.

sudo mkdir -p /var/www/

sudo tar xvf $PFA_FILE -C /var/www/

sudo mv /var/www/postfixadmin-$LATEST_PFA /var/www/postfixadmin

rm -f $PFA_FILE

Follow the rest of linuxbabes PostfixAdmin until step Nginx

At step, Nginx it is broken. That sets it up for http and not https. However, https is better to serve and admin page so use the below to correctly setup for https note red sections and change accordingly to your configuration needs.

sudo nano /etc/nginx/conf.d/postfixadmin.conf
server {
   listen 443 ssl http2;
   listen [::]:443 ssl http2;
   ssl_certificate /etc/acme/;
   ssl_certificate_key /etc/acme/;
   ssl_protocols       TLSv1.1 TLSv1.2;
   ssl_ciphers         HIGH:!aNULL:!MD5;

   root /var/www/postfixadmin/public/;
   index index.php index.html;

   access_log /var/log/nginx/postfixadmin_access.log;
   error_log /var/log/nginx/postfixadmin_error.log;

   location / {
       try_files $uri $uri/ /index.php;

   location ~ ^/(.+\.php)$ {
        try_files $uri =404;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;

Leave a Reply

Your email address will not be published. Required fields are marked *