Use RainLoop to Access G Suite Emails on Ubuntu with Nginx Support

For those who don’t know about RainLoop, it’s a simple and modern web-based email client which is based on the LAMP or LEMP stack. It supports IMAP and SMTP protocols including SSL and STARTTLS.

With RainLoop, one can all access his/her emails from different email providers via a single modern web interface.

This brief tutorial is going to show students and new users how to install RainLoop on Ubuntu and configure it to access  G Suite emails. You may be able to configure it for other web mails as well.

Some of the features supported by RainLoop are:

  • Modern user interface.
  • Complete support of IMAP and SMTP protocols including SSL and STARTTLS.
  • Sieve scripts (Filters and vacation message).
  • Minimalistic resources requirements.
  • Direct access to mail server is used (mails are not stored locally on web server).
  • Allows for adding multiple accounts to primary one, simultaneous access to different accounts in different browser tabs is supported. Additional identities.
  • Administrative panel for configuring main options.
  • Really simple installation and update (the product is updated from admin panel).
  • Integration with Facebook, Google, Twitter and Dropbox.

Follow the steps below to install RainLoop on Ubuntu

Step 1: Install Nginx and PHP

The basic requirements for RainLoop to function on Ubuntu is to have a webserver and PHP/extensions. Optional packages are MySQL or other open source database servers and extensions. If you’re not going to be hosting emails on your server, then just install a webserver and PHP packages.

For this tutorial, we’re not going to be downloading our emails on our servers. We’ll be reading our emails online via the web interface, so no need for a database server here.

To install Nginx, run the commands below

sudo apt-get update
sudo apt-get install nginx

To install PHP and other extensions, run the commands below

sudo apt-get update
sudo apt-get -y install php-mysql php-curl php-gd php-pear php-imagick php-imap php-mcrypt php-recode php-tidy php-xmlrpc

Step 2: Create RainLoop Root directory

Now that Nginx and PHP and extensions are installed, go and create RainLoop root directory. To do that, run the commands below.

sudo mkdir -p /var/www/html/rainloop

Then go to the root directory and download the latest version for RainLoop

cd /var/www/html/rainloop
wget -qO-  | php

Next, run the commands below to configure the correct file/folder permissions for RainLoop to function.

sudo chmod -R 755 /var/www/html/rainloop
sudo chown -R www-data:www-data /var/www/html/rainloop

Step 3: Configure RainLoop Nginx settings

Next, create a RainLoop site configuration file by running the commands below.

sudo nano /etc/nginx/sites-available/rainloop.conf

Then these lines into the file and save it.

server {
    listen   80;
    listen [::]:80;
    server_name  example.com www.example.com;
    root   /var/www/html/rainloop;
    index  index.php;
    autoindex off;
    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    # pass the PHP scripts to FastCGI server
## PHP settings
    location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    root /var/www/html/rainloop;
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    try_files $uri =404;
    fastcgi_index index.php;

    include fastcgi_params;
    }

    location ^~ /data {
    deny all; 
    }
}

Save the file.

Step 4: Enable RainLoop Site

Finally, run the commands below to enable RainLoop site on Nginx

sudo ln -s /etc/nginx/sites-available/rainloop.conf /etc/nginx/sites-enabled/

After that, restart Nginx.

sudo nginx -t
sudo systemctl restart nginx

When you’re done, browse to the URL you defined in the config file to the admin page.

The default username and password as followed:

Username: admin

Password: 12345

When you login, select the Login link on the left and enter the default login. example.com

Next, go to Domain and add a new domain. It should look like the image below for G-Suite account

rainloop gsuite ubuntu

Save test your settings to make sure it’s working and save.

That’s it.

Users with valid G-Suite accounts should be able to login and view their emails.

Enjoy!

You may also like this post: