In the end, I will make this into an installer script. However, for now I am going to document the steps needed to do just that process. Overall, this will be made into a script to simplify install.

LATEST_RND=$(curl -v https://github.com/roundcube/roundcubemail/releases/latest  2> >(grep 'location:') >/dev/null | awk -F/ '{print ($NF)}') 
LATEST_RND=$(echo -n "${LATEST_RND%$'\r'}") 
RND_FILE="roundcubemail-${LATEST_RND}-complete.tar.gz" 
RND_URL="https://github.com/roundcube/roundcubemail/releases/download/${LATEST_RND}/${RND_FILE}"

So, with the gz file expressed as a URL it is time to get the latest one with wget.

sudo apt install wget

wget $RND_URL

Now, it is time to extract it and place into www folder for web server to see.

tar xvf $RND_FILE

sudo mkdir -p /var/www/

sudo mv roundcubemail-${LATEST_RND} /var/www/roundcube

rm -f $RND_FILE

cd /var/www/roundcube

sudo chown www-data:www-data temp/ logs/ -R

Finally, follow Step 1 here to setup MariaDB, and LinuxBabe's Roundcube Setup starting here at Step 2.

Well, that did not work so here is how I did it...

Install Support Libraries

First, have to install needed libraries lin gpg. Very much like Debian 11 apt-key Deprecated So Now What?

sudo apt update

sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2

KEYRING=/etc/apt/trusted.gpg.d/sury-keyring.gpg

curl -fsSL  https://packages.sury.org/php/apt.gpg| sudo gpg --dearmor -o $KEYRING


echo "deb [signed-by="$KEYRING"] https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list

Finally, packages are available to be installed. So, install php 8.1.

sudo apt update

sudo apt install php-net-ldap2 php-net-ldap3 php-imagick php8.1-fpm php8.1-common php8.1-gd php8.1-imap php8.1-mysql php8.1-curl php8.1-zip php8.1-xml php8.1-mbstring php8.1-bz2 php8.1-intl php8.1-gmp php8.1-redis

To configure, create a nginx config for https in /etc/nginx/conf.d/webmail.alshowto.com

sudo nano /etc/nginx/conf.d/webmail.alshowto.com
server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;

  server_name webmail.alshowto.com;

  ssl_certificate /etc/acme/real-alshowto.com.fullchain;
  ssl_certificate_key /etc/acme/real-alshowto.com.key;
  ssl_protocols       TLSv1.1 TLSv1.2;
  ssl_ciphers         HIGH:!aNULL:!MD5;
   
  root /var/www/roundcube/;
  index index.php index.html index.htm;

  error_log /var/log/nginx/roundcube.error;
  access_log /var/log/nginx/roundcube.access;

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

  location ~ \.php$ {
   try_files $uri =404;
    fastcgi_pass unix:/run/php/php8.1-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }

 # location ~ /.well-known/acme-challenge {
 #   allow all;
 # }
 location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
    deny all;
  }
  location ~ ^/(bin|SQL)/ {
    deny all;
  }
 # A long browser cache lifetime can speed up repeat visits to your page
  location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
       access_log        off;
       log_not_found     off;
       expires           360d;
  }
}

Oh, Do not forget to add a DNS A and AAAA record for url path specified in the config file and highlighted in red in above example. Also, add the letsencrypt -d to it as well. Note: my case follows my Let's Encrypt Using pfSense Acme Plugin.

Leave a Reply

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