Skip to content
🧮 Is Lifetime with ZapX Pass worth it? Work it out for your own servers in 30 seconds. Open the Lifetime calculator →

Set Up Roundcube on a Linux Server – Your Own Webmail for Your Mailbox

Set up Roundcube as a One-Click App or with Docker on your VPS, configure IMAP and SMTP correctly, and read and write emails in your browser.

2 December 202612 min read5 Views0 helpful

Introduction

Roundcube is a popular webmail program. You can read, write, and sort your emails in your browser, manage contacts, and create senders with your own signature. One important thing to know: Roundcube is not a mail server. It accesses an existing mailbox via IMAP and sends email through your provider's SMTP server. Your emails remain on the mail server; Roundcube only stores settings, contacts, and senders.

In this guide, we'll show you two ways to install Roundcube: the easy way as a One-Click App, which gets Roundcube running at its own address with HTTPS in just a few minutes, and a manual installation with Docker Compose and an nginx reverse proxy. After that, you'll learn how to set up senders, signatures, and contacts, and what Roundcube's limitations are.

When it makes sense to run Roundcube on a VPS

Running your own Roundcube is worthwhile if:

  • You already have a mailbox with IMAP access, for example through your domain or email provider, and want a better or custom web interface for it.
  • Several people need to use their mailboxes from the same mail server in a browser, such as in a club or small team, at a shared address like webmail.example.com.
  • You want to read email on other people's computers without setting up an email program there.
  • You want to choose your own webmail interface, for example the attachment size limit or the address your webmail runs at.

Roundcube is less suitable if you don't have a mailbox yet. In that case, you first need a mail server. The easiest way to get one is with the ZAP Webspace + Mail app, which already includes Roundcube.

Roundcube or ZAP Webspace + Mail?

The app catalog offers Roundcube on its own and as part of ZAP Webspace + Mail. The two apps serve different purposes:

RoundcubeZAP Webspace + Mail
What you getWebmail onlyMail server, Roundcube webmail, and webspace
MailboxesAlready exist with another providerYou create them yourself using your own domain
Emails are storedOn your provider's mail serverOn your VPS
DNS records for emailNot neededYou add the MX, SPF, DKIM, and DMARC records yourself
Typical useYour own webmail for an existing mailboxCreating your own email addresses from scratch

If you want your own email addresses and mail server, follow the guide Web Hosting: Set Up Email with Your Own Mail Server. Roundcube is already included, so you don't need to install the Roundcube app separately. The standalone Roundcube app is intended for existing mailboxes, for example with an external provider or on a mail server running on another server.

Easy option: Roundcube as a One-Click App

With your VPS's One-Click Apps, Roundcube will be available at its own address with HTTPS after just a few minutes. During installation, you only need to specify which mail server Roundcube should connect to.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See VPS: One-Click Apps for instructions.
  • At least 512 MB RAM, 1 vCPU core, and 2 GB of storage for the app. 1 GB RAM and 2 vCPU cores are recommended. The emails themselves are stored on the mail server and don't take up space on the VPS.
  • A mailbox with IMAP and SMTP access, along with your provider's server details: hostname, ports, and encryption. You can usually find these in your provider's help center under “IMAP settings” or “Set up an email program.”

Entering the server details correctly

Roundcube expects the hostname to be preceded by a prefix that specifies the encryption method:

PrefixEncryptionDefault port in the app
ssl://SSL/TLS from the start of the connectionIMAP 143, SMTP 587
tls://STARTTLSIMAP 143, SMTP 587

The app always uses port 143 for IMAP and port 587 for SMTP, including when using ssl://. For the usual combinations, this means:

  • IMAP with SSL/TLS on port 993 (most providers): Enter ssl://mail.example.com and also add the variable ROUNDCUBEMAIL_DEFAULT_PORT with the value 993 (see below).
  • IMAP with STARTTLS on port 143: Enter tls://mail.example.com; you don't need a port variable.
  • SMTP with STARTTLS on port 587: Enter tls://mail.example.com. This works with almost all providers.
Warning: Never omit the prefix

Without ssl:// or tls://, Roundcube connects without encryption and sends your password to the mail server in plain text. Many servers reject this, causing the login to fail.

For SMTP, we recommend using port 587 with tls://. On new VPSs, outgoing connections on ports 25 and 465 are blocked until you verify your phone number in your account. Port 587 is not affected.

Installation

  1. Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
  2. Search for “Roundcube” in the App catalog and click Install app next to Roundcube.
  3. Enter a name under App name and leave Use a custom subdomain or zap.cloud enabled. Choose the address where your webmail should be available, for example the webmail prefix.
  4. Under App configuration, enter the IMAP server in ROUNDCUBEMAIL_DEFAULT_HOST and the SMTP server in ROUNDCUBEMAIL_SMTP_SERVER, as described above. Both fields are required.
  5. If your provider uses IMAP on port 993: Under Custom environment variables, click the plus icon (Add variable) and add ROUNDCUBEMAIL_DEFAULT_PORT with the value 993.
  6. Click Queue installation.

After one or two minutes, the app will show as Online. Click the Access link on the app card to open the Roundcube login page.

First login

Roundcube doesn't have its own admin account or password. You log in directly with your mailbox credentials: the username is usually your full email address, along with your mailbox password. The first time you log in, Roundcube automatically creates settings, contacts, and a sender for that mailbox.

After that, you'll see your folders on the left, the message list in the middle, and the open email on the right. Roundcube uses the language set in your browser. To change it, go to Settings > Preferences > User Interface.

If you can't log in, Roundcube displays a message in the bottom-right corner:

MessageMeaningSolution
Connection to storage server failed.Roundcube can't reach the IMAP server.Check the hostname, prefix, and port. For ssl://, you usually need to set ROUNDCUBEMAIL_DEFAULT_PORT = 993.
Login failed.The server is reachable but rejected the username or password.Check your login details. For Gmail, use an app password.

Who can log in

Anyone with a mailbox and password on the configured mail server can log in. There is no server field on the login page: Roundcube only connects to the server specified in the app configuration, even if someone tries to provide a different server. This means outsiders can't misuse your webmail to access arbitrary mail servers. Roundcube only sends email using the credentials of the logged-in mailbox.

Because the login page is publicly accessible, automated login attempts can start quickly. After three incorrect passwords within one minute, Roundcube temporarily blocks login attempts for a mailbox it already knows about. The main protection is a strong password for every mailbox.

Changing settings later

You can change servers, ports, and other options in the app settings (gear icon) under App environment. The two required fields are at the top. Add other variables under Custom environment variables using the plus icon. After you click Save, the app restarts and will be available again in about a minute.

Useful variables:

VariableEffectExample
ROUNDCUBEMAIL_DEFAULT_PORTIMAP port; defaults to 143 if not specified993
ROUNDCUBEMAIL_SMTP_PORTSMTP port; defaults to 587 if not specified465
ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZEMaximum size per attachment; defaults to 5M25M
ROUNDCUBEMAIL_USERNAME_DOMAINAppends the domain to the username if someone enters only the part before the @ signexample.com
Info: Larger attachments

By default, Roundcube accepts attachments up to 5 MB. Set ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE = 25M to allow files up to 25 MB each. However, your email provider determines the maximum size of an entire email. Many providers allow 20 to 50 MB.

Warning: Changing mail servers

Roundcube associates settings, contacts, and senders with the mail server. If you later enter a different hostname, every mailbox in Roundcube will start with an empty contact list. Export your contacts as a vCard under Contacts first.

Updates and backups

  • Updates: Open the app settings (gear icon) > App update and click Check for updates. If a new version is available, install it using Apply update. The app uses the Roundcube 1.7 release series, and Roundcube updates the database itself when it starts.
  • Backups: A VPS backup from the Backups tab also backs up the roundcube-db volume (settings, contacts, senders) and the roundcube-data volume (additional configuration files). Your email provider backs up your emails; they aren't stored on the VPS.
  • Uninstalling: Under App actions > Uninstall app, you can also delete the data volumes. This removes your Roundcube contacts and settings, but your emails remain on the mail server.

Manual installation

The rest of this guide covers the manual installation of Roundcube with Docker Compose, for example on a server without One-Click Apps. You'll run Roundcube with a MariaDB database, expose the port locally only, and make webmail accessible through nginx with a Let's Encrypt certificate.

Requirements

MinimumRecommended
CPU1 vCPU core2 vCPU cores
RAM512 MB1 GB
Storage2 GB5 GB

You'll also need:

Preparing the firewall

Roundcube only needs the web ports to be accessible from the outside. Roundcube connects to the mail server itself, so you don't need to open any ports for those connections. Open SSH, HTTP, and HTTPS in ufw:

Code
sudo apt install -y ufw
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable

Don't open Roundcube's port. Docker bypasses ufw rules for published ports, so bind the port to 127.0.0.1 in the Compose file. That way, only nginx on the same server can access it. For more information, see VPS: Open Ports and Manage the Firewall on Linux.

Installation with Docker Compose

Create a directory and generate a .env file with a random database password:

Code
sudo mkdir -p /opt/roundcube && cd /opt/roundcube
echo "DB_PASSWORD=$(openssl rand -hex 24)" | sudo tee .env
sudo chmod 600 .env

Then create the compose.yml file, for example with sudo nano compose.yml:

Code
services:
  db:
    image: mariadb:11
    restart: unless-stopped
    environment:
      MARIADB_RANDOM_ROOT_PASSWORD: "yes"
      MARIADB_DATABASE: roundcubemail
      MARIADB_USER: roundcube
      MARIADB_PASSWORD: ${DB_PASSWORD}
    volumes:
      - roundcube-db:/var/lib/mysql

  roundcube:
    image: roundcube/roundcubemail:1.7.x-apache
    restart: unless-stopped
    depends_on:
      - db
    environment:
      ROUNDCUBEMAIL_DB_TYPE: mysql
      ROUNDCUBEMAIL_DB_HOST: db
      ROUNDCUBEMAIL_DB_USER: roundcube
      ROUNDCUBEMAIL_DB_PASSWORD: ${DB_PASSWORD}
      ROUNDCUBEMAIL_DB_NAME: roundcubemail
      ROUNDCUBEMAIL_DEFAULT_HOST: ssl://mail.example.com
      ROUNDCUBEMAIL_DEFAULT_PORT: "993"
      ROUNDCUBEMAIL_SMTP_SERVER: tls://mail.example.com
      ROUNDCUBEMAIL_SMTP_PORT: "587"
      ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE: 25M
    ports:
      - "127.0.0.1:8000:80"
    volumes:
      - roundcube-config:/var/roundcube/config

volumes:
  roundcube-db:
  roundcube-config:

The important lines:

  • image uses the Roundcube 1.7 release series with Apache. The 1.7.x-apache tag gets all bug fixes for this series, including security updates.
  • MARIADB_USER and MARIADB_PASSWORD create a dedicated database user for Roundcube. The database root password is generated randomly and isn't needed.
  • ROUNDCUBEMAIL_DEFAULT_HOST and ROUNDCUBEMAIL_SMTP_SERVER are your provider's servers. Replace mail.example.com with your own values. The ports are specified separately in ROUNDCUBEMAIL_DEFAULT_PORT and ROUNDCUBEMAIL_SMTP_PORT.
  • 127.0.0.1:8000:80 makes Roundcube accessible only from the server itself.
  • You can put your own configuration files (*.php) in the roundcube-config volume. Roundcube loads them every time it starts.

Start Roundcube:

Code
sudo docker compose up -d
sudo docker compose logs -f roundcube

On the first start, Roundcube creates the tables in the database. Once Creating database schema... [OK] appears, followed by resuming normal operations, Roundcube is ready. Press Strg + C to exit the log view.

First access

First, check locally whether Roundcube responds:

Code
curl -sI http://127.0.0.1:8000/

The response starts with HTTP/1.1 200 OK. In the next step, you'll set up browser access through nginx with HTTPS. Then log in with your mailbox credentials, as described above under “First login.”

Access via HTTPS through a reverse proxy

Install nginx and Certbot:

Code
sudo apt install -y nginx certbot python3-certbot-nginx

Create the /etc/nginx/sites-available/roundcube file:

Code
server {
    listen 80;
    server_name webmail.example.com;

    client_max_body_size 30M;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

client_max_body_size must be slightly larger than the attachment limit set by ROUNDCUBEMAIL_UPLOAD_MAX_FILESIZE; otherwise, nginx will reject larger uploads. Enable the site and obtain the certificate:

Code
sudo ln -s /etc/nginx/sites-available/roundcube /etc/nginx/sites-enabled/roundcube
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d webmail.example.com

Certbot adds the HTTPS block and redirects HTTP to HTTPS. For more on the basics, see VPS: Set Up an nginx Reverse Proxy on Linux and VPS: Create an SSL Certificate (Let's Encrypt) for Linux Servers.

Backing up your data

Roundcube stores settings, contacts, and senders in the database. You can back up the database while it is running:

Code
cd /opt/roundcube
sudo docker compose exec -T db sh -c 'mariadb-dump -u roundcube -p"$MARIADB_PASSWORD" roundcubemail' | sudo tee /root/roundcube-db-$(date +%F).sql > /dev/null

Also back up compose.yml, .env, and any custom files from the roundcube-config volume. Then copy the backup to another computer or storage location. A backup on the same server won't protect you if that server fails. Your email provider backs up the emails themselves.

Updating Roundcube

The 1.7.x-apache tag receives new versions in the 1.7 series. Pull them regularly:

Code
cd /opt/roundcube
sudo docker compose pull
sudo docker compose up -d

When it starts, Roundcube applies the update and adjusts the database itself. To switch to a new release series (for example, 1.8), change the tag in compose.yml. First, read the Roundcube release notes and back up the database.

Using Roundcube day to day

After your first login, it's worth taking a quick look at the settings. You'll find the most important options under Settings in the left sidebar.

Setting up a sender and signature

Under Settings > Identities, you'll find your sender. Click it and enter your name under Display Name so recipients see more than just your email address. Below that, add a signature under Signature and click Save. Use Create to add additional senders, for example for an alias of your mailbox. Your mail server determines whether you're allowed to send from another address.

Importing contacts

You can import existing address books under Contacts. Roundcube reads vCard and CSV files exported from your previous email program or webmail. You can also export your contacts there as a vCard, for example before changing mail servers.

Folders and display

Under Settings > Folders, you can show or hide mailbox folders and create new ones. Under Settings > Preferences, you can configure the language, time zone, and message list display. Under Special Folders, you can select the folders for sent and deleted emails. Click Dark mode in the bottom-left corner to switch to the dark theme.

Limitations

  • Not a mail server: You can't log in without a mailbox from a provider or on your own mail server.
  • One mail server per installation: All users log in to the same IMAP server. If you have mailboxes with different providers, you'll need multiple installations.
  • No filter rules: The filters section is missing because the app only enables extensions for archiving and ZIP downloads. Set up sorting rules with your email provider.
  • No calendar: Roundcube is webmail with an address book only.
  • Gmail and Microsoft: For Gmail, log in with an app password from your Google account, not your regular password. Microsoft accounts (Outlook.com, Hotmail, Microsoft 365) no longer allow password-based IMAP login. Roundcube would need OAuth login for these accounts, which isn't included in the One-Click App.

Conclusion

With Roundcube, you now have your own webmail at your own address, letting you use your existing mailbox in the browser with senders, a signature, and contacts. Next, Set Up Radicale on a Linux Server shows you how to sync calendars and contacts on your own server.

If you have any other questions or need help, our support team is available every day! 🙂

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

For most people, the One-Click App is the faster option: Roundcube is available at your address with HTTPS in just a few minutes. You only need to enter the IMAP and SMTP servers, and you can install updates through the ZapX dashboard. Manual installation with Docker Compose makes sense if you want to run Roundcube on a server without One-Click Apps, use custom configuration files and extensions, or manage the database yourself.
No. Roundcube is only the web interface for an existing mailbox. It reads your email from the mail server via IMAP and sends it through that server's SMTP service. If you need your own email addresses and mail server, use the ZAP Webspace + Mail app, which already includes Roundcube.
Enter your provider's hostname with an encryption prefix: ssl:// for SSL/TLS or tls:// for STARTTLS, for example tls://mail.example.com. The app uses IMAP port 143 and SMTP port 587. If your provider uses IMAP with SSL/TLS on port 993, enter ssl://mail.example.com and add ROUNDCUBEMAIL_DEFAULT_PORT with the value 993 under Custom environment variables.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.