Roundcube
Roundcube is an open-source webmail client. It works as a fully functional MUA (mail user agent) with plugins.
The official guide wiki is available. This article follows the guide and adds some customization based on how this server is configured.
Install
Download the “Complete” package roundcubemail-x.x.x-complete.tar.gz from the official download page. It contains all required packages (some additional ones are still needed).
Extract compressed files.
tar xfz roundcubemail-x.x.x-complete.tar.gz
- It contains empty
tempandlogsdirectories. You don’t need to create them manually later.
Move the directory to /var/www/. For future updates, delete the version number from the directory name.
sudo mv ./roundcubemail-x.x.x /var/www/roundcube
Change owner to www-data (nginx should have write access to the directory).
sudo chown -R www-data:www-data /var/www/roundcube
Database configuration
In my case, the number of users is so small that I use SQLite. SQLite doesn’t require any preparation. The database file will be automatically created during the setup process.
nginx configuration
Prepare the SSL/TLS certificate for this site and create /etc/nginx/sites-available/mail.example.jp for Roundcube and enable it.
server {
listen 80;
listen [::]:80;
server_name mail.example.jp;
include snippets/certbot.conf;
}
server {
include snippets/https-common.conf;
ssl_certificate /etc/letsencrypt/live/mail.example.jp/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mail.example.jp/privkey.pem;
server_name mail.example.jp;
# Since 1.7, point to public_html for security reasons
root /var/www/mail.example.jp/public_html;
index index.php;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
access_log /var/log/nginx/mail.example.jp-access.log;
error_log /var/log/nginx/mail.example.jp-error.log;
}
Setup Roundcube
Additional php packages
Access https://mail.example.jp/installer.php to start the initial setup.
This will check if all required packages are available and show missing items.
- The basic extensions installed with PHP itself should cover all requirements.
Roundcube configuration
- Choose
SQLiteas the database and set the path, for example,/var/www/roundcube/sqlite.db - IMAP should work with default configuration.
- SMTP needs
ssl://prefix to use Submissions. To avoid certificate errors, set smtp_host to the FQDN:ssl://mail.example.jp:465
“Create config” will save the config file. The “Continue” button will check the directory and DB permissions.
Check if SMTP and IMAP login work.
Delete installer directory.
sudo rm -r /var/www/roundcube/installer
Access Roundcube
Now https://mail.example.jp/ should work, and you can log in with your mail addresses and their passwords.