Skip to content

Instantly share code, notes, and snippets.

@jniltinho
Last active March 16, 2024 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jniltinho/b318485c31e22c848dd0828090eae6c4 to your computer and use it in GitHub Desktop.
Save jniltinho/b318485c31e22c848dd0828090eae6c4 to your computer and use it in GitHub Desktop.
Install RoundCube Ubuntu
#!/bin/bash
## Links
## Ubuntu|Debian
## https://www.linuxtuto.com/how-to-install-roundcube-on-ubuntu-22-04/
## https://medium.com/@community.vahid/stable-webmail-install-roundcube-webmail-ubuntu-22-04-lts-server-semi-stable-ec4349c1804b
## https://caddy.community/t/help-configuring-php-fpm-status-for-caddy2/19737/7
## https://www.atlantic.net/vps-hosting/how-to-install-and-configure-caddy-web-server-with-php-on-rocky-linux/
## https://www.howtoforge.com/tutorial/how-to-install-caddy-web-server-with-php-fpm-on-ubuntu-1604/
apt update
apt dist-upgrade
apt install -y nginx wget curl
apt install -y php php-fpm php-gd php-common php-json php-imagick php-imap php-xml php-mbstring php-curl php-zip
apt install -y php-bz2 php-intl php-ldap php5.6-mysql python3-certbot-nginx
#systemctl start php8.1-fpm
#systemctl enable php8.1-fpm
mkdir -p /var/www/webmail
cd /tmp
VERSION=1.6.6
wget https://github.com/roundcube/roundcubemail/releases/download/$VERSION/roundcubemail-$VERSION-complete.tar.gz
tar -xvzf roundcubemail-$VERSION-complete.tar.gz -C /var/www/webmail/ --strip-components 1
chown -R www-data:www-data /var/www/webmail
chmod 755 -R /var/www/webmail
cat <<'EOF' >/etc/nginx/conf.d/webmail.conf
server {
listen 80;
server_name webmail.your-domain.com;
root /var/www/webmail;
index index.php index.html index.htm;
error_log /var/log/nginx/webmail.error;
access_log /var/log/nginx/webmail.access;
location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
deny all;
}
location ~ ^/(config|temp|logs)/ {
deny all;
}
location ~ /\. {
deny all;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
}
EOF
systemctl restart nginx
## Create SSL
## certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email you@your-domain.com -d webmail.your-domain.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment