Using RoundCube Webmail With ISPConfig 3 On Debian Wheezy (nginx)

Version 1.0
Author: Falko Timme
Follow me on Twitter
Last edited 10/09/2013

This guide explains how to install the RoundCube webmail application on a Debian Wheezy server running ISPConfig and nginx, and how to enable the ISPConfig 3 plugins for RoundCube so that users can perform actions like changing their email passwords from within RoundCube. Roundcube webmail is a browser-based multilingual IMAP client with an application-like user interface; it comes with functions like MIME support, address book, folder manipulation, message searching and spell checking.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

This tutorial assumes you are using nginx as the web server on your ISPConfig 3 server; this tutorial will not work for Apache. I'm going to install RoundCube from the Debian Wheezy repositories - it is a reasonably recent version (0.7.2.9 vs 0.9.1 (current stable version)).

I will show how to configure a vhost for RoundCube so that it can be accessed over the alias /webmail (e.g. http://www.example.com/webmail).

 

2 Creating A Remote User In ISPConfig

The ISPConfig 3 plugins for RoundCube work through ISPConfig's remote API. To use this API, we need a remote user. To create such a user, go to System > User Management > Remote Users and click on the Add new user button:

Provide a username and password for the user...

... and enable the following functions:

  • Server functions
  • Client functions
  • Mail user functions
  • Mail alias functions
  • Mail spamfilter user functions
  • Mail spamfilter policy functions
  • Mail fetchmail functions
  • Mail spamfilter whitelist functions
  • Mail spamfilter blacklist functions
  • Mail user filter functions

Then click on Save.

 

3 Installing RoundCube

We can install RoundCube as follows:

apt-get install roundcube roundcube-plugins roundcube-plugins-extra

You will see the following questions:

Configure database for roundcube with dbconfig-common? <-- Yes
Database type to be used by roundcube: <-- mysql
Password of the database's administrative user: <-- yourrootsqlpassword (the password of the MySQL root user)
MySQL application password for roundcube: <-- roundcubesqlpassword
Password confirmation: <-- roundcubesqlpassword

This will create a MySQL database called roundcube with the MySQL user roundcube and the password roundcubesqlpassword.

Next go to your website in ISPConfig. On the Options tab, you will see the nginx Directives field:

Fill in the following directives and click on Save (it does not matter if you have PHP enabled for this vhost or not because this code snippet uses the system's default PHP which runs under the user and group www-data which is important because RoundCube is installed outside of the vhost's document root - in /var/lib/roundcube):

client_max_body_size 100M;

location /roundcube {
         root /var/lib/;
         index index.php index.html index.htm;
         location ~ (.+\.php)$ {
                    try_files $uri =404;
                    include /etc/nginx/fastcgi_params;
                    # To access SquirrelMail, the default user (like www-data on Debian/Ubuntu) must be used
                    #fastcgi_pass 127.0.0.1:9000;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_intercept_errors on;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_buffer_size 128k;
                    fastcgi_buffers 256 4k;
                    fastcgi_busy_buffers_size 256k;
                    fastcgi_temp_file_write_size 256k;
         }
         location ~* /.svn/ {
                     deny all;
         }
         location ~* /README|INSTALL|LICENSE|SQL|bin|CHANGELOG$ {
                     deny all;
         }
}
location /webmail {
         rewrite ^ /roundcube last;
}

With this configuration, RoundCube will be accessible under the URLs http://www.example.com/webmail and http://www.example.com/roundcube.

 

4 Configuring RoundCube

Open /etc/roundcube/main.inc.php...

vi /etc/roundcube/main.inc.php

... and set $rcmail_config['default_host'] = 'localhost'; (or the hostname or IP address of your mail server if it is on a remote machine):

[...]
$rcmail_config['default_host'] = 'localhost';
[...]

Otherwise RoundCube will ask for a hostname before each login which might overstrain your users - we want to make usage as easy as possible.

Next install the ISPConfig 3 plugins for RoundCube:

cd /tmp
git clone https://github.com/w2c/ispconfig3_roundcube.git
cd /tmp/ispconfig3_roundcube/
mv ispconfig3_* /usr/share/roundcube/
cd /usr/share/roundcube/
mv ispconfig3_account/config/config.inc.php.dist ispconfig3_account/config/config.inc.php
ln -s /usr/share/roundcube/ispconfig3_* /var/lib/roundcube/plugins/

Open ispconfig3_account/config/config.inc.php...

vi ispconfig3_account/config/config.inc.php

... and fill in the login details of your ISPConfig remote user and the URL of the remote API - my ISPConfig installation runs on https://192.168.0.100:8080, so the URL of the remote API is https://192.168.0.100:8080/remote/:

<?php
$rcmail_config['identity_limit'] = false;
$rcmail_config['remote_soap_user'] = 'roundcube';
$rcmail_config['remote_soap_pass'] = 'Sw0wlytlRt3MY';
$rcmail_config['soap_url'] = 'https://192.168.0.100:8080/remote/';
?>

Finally open /etc/roundcube/main.inc.php again...

vi /etc/roundcube/main.inc.php

... and enable the jquerui plugin plus the ISPConfig 3 plugins...

[...]
// ----------------------------------
// PLUGINS
// ----------------------------------

// List of active plugins (in plugins/ directory)
//$rcmail_config['plugins'] = array();
$rcmail_config['plugins'] = array("jqueryui", "ispconfig3_account", "ispconfig3_autoreply", "ispconfig3_pass", "ispconfig3_spam", "ispconfig3_fetchmail", "ispconfig3_filter");
[...]

... and change the skin from default to classic (otherwise the ISPConfig 3 plugins will not work):

[...]
// skin name: folder from skins/
$rcmail_config['skin'] = 'classic';
[...]

That's it; now you can access RoundCube under the alias /webmail (e.g. www.example.com/webmail). Log in with the email address and password of an email account created through ISPConfig:

This is how RoundCube looks:

Under Settings > Account you can use the ISPconfig 3 plugins for RoundCube to modify your settings, for example...

... you can set a new password for your email account without using ISPConfig:

 

 

About The Author

Falko Timme is the owner of nginx WebhostingTimme Hosting (ultra-fast nginx web hosting). He is the lead maintainer of HowtoForge (since 2005) and one of the core developers of ISPConfig (since 2000). He has also contributed to the O'Reilly book "Linux System Administration".

Share this page:

13 Comment(s)

Add comment

Comments

From: Horfic at: 2013-10-10 11:10:09

I do not recommend to install roundcube per debian package, as it is outdate!!!

Current roundcube version is like 0.9.x

 The debian package only got like 0.5.x at maximum.

From: admin at: 2013-10-11 10:22:54

RoundCube version in Debian Wheezy is 0.7.2, in Debian Jessie (testing) it is 0.9.4. I've tested both, and both were working fine.

From: Atatoth at: 2013-10-10 23:35:44

for me not working.... when i add plugins on every plugin page i see loading and after some time nginx error 504 :(

From: Spodnet at: 2013-11-04 20:15:09

The version of roundcube with wheezy is out of date. The backports version is 0.9.x.

To add backports, add this to your apt sources.list, replacing YOURMIRROR with your choosen mirror.

 

deb http://YOURMIRROR.debian.org/debian wheezy-backports main

 

If you use nginx, then you will need to use:

 

aptitude -R -t wheezy-backports install roundcube-mysql roundcube-plugins roundcube-plugins-extra

 

If not

 

aptitude -t wheezy-backports install roundcube-mysql roundcube-plugins roundcube-plugins-extra

 

Should work.

From: at: 2013-10-31 19:03:28

thanks

From: at: 2014-06-27 19:50:09

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"
Can someone tell me how to fix this nginx/error.log

2014/06/27 22:15:14 [error] 3362#0: *1088 FastCGI sent in stderr: "PHP message: PHP Strict Standards: Non-static method PEAR::setError Handling() should not be called statically in ***/program/include/iniset.php on line 131" while reading response header from upstream, upstream: "fastcgi://unix:/var/lib/php5-fpm/ispconfig.soc

 

 

 

From: at: 2014-07-11 03:27:35

When I tried this, it couldn't load any css or images from the roundcube directory. I had to add the following to the "location /roundcube" block to make it work:

location ~* ^/roundcube/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /var/lib/;
}

From: julien at: 2014-08-17 21:13:15

That fix works.

 Also, in /etc/roundcube/main.inc.php the language at

<code> $rcmail_config['language'] = 'ar_AR';</code>

 need to be changed into en_US, or you may see eveything in arabic.

 

From: at: 2014-07-22 10:43:12

Hi, I've installed all packages from this giu, all ispconfig plugins works but only one doesn't, it's autoreply plugin. when i click on link in roudcube then nothing is showing :/ rest of plugins works.

does anybody may know, what is wrong?

how can i debug this?


 

From: BQ911 at: 2015-03-30 21:03:54

I have the same issue with the autoreply! Anybody ...

From: byman64 at: 2014-12-01 22:08:33

Hi, great article, I installed roundcube on my ubuntu server 14.04 and it works fine. 

I would like upgrade roundcube to last version 1.x but I am not sure how to it without ruine my configuration. Any idea?

 

 

From: Rob at: 2015-04-29 22:25:45

I followed these instructions and all is working... Except for the default server...

[...] $rcmail_config['default_host'] = 'localhost'; [...]

This does not seem to have any effect on the login screen. I still have to enter the server name everytime.

 

Any ideas?

 

Thanks,

Rob

From: Ignacio Colautti at: 2015-06-19 17:50:11

Hi,

I added to the nginx directives options this configuration: https://github.com/h5bp/server-configs-nginx/blob/master/h5bp/location/expires.conf

The problem is that the regex expresion is match and the roundcube location is not selected, so roundcube doesn't work.Is there a way to fix this?

Thank you