How to Configure Postfix with Webmail on Ubuntu 18.04

Install phpmyadmin

apt update && apt install phpmyadmin && apt install nginx
ln -s /usr/share/phpmyadmin /var/www/html/pma
systemctl restart nginx

Download and configure roundcube

cd /var/www/html && wget
--2018-06-18 13:08:37--

tar xvf roundcubemail-1.3.6-complete.tar.gz

mv roundcubemail-1.3.6 webmail

 rm roundcubemail-1.3.6-complete.tar.gz && cd webmail

Create the roundcube database

mysql> CREATE DATABASE roundcubedb;
mysql> CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'your-roundcubedb-password';
mysql> GRANT ALL PRIVILEGES ON roundcubedb.* to 'roundcube'@'localhost';
mysql> EXIT;

 mysql -u roundcube -p roundcubedb < SQL/mysql.initial.sql

 Nginx configuration file 

# vim /etc/nginx/sites-available/default
location /webmail {
        root /var/www/html;
        index index.php;
        location ~ ^/webmail/(.+\.php)$ {
                root /var/www/html;
                try_files $uri =404;
                fastcgi_index index.php;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
        location ~ ^/webmail/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
                deny all;
        location ~ ^/webmail/(bin|SQL|config|temp|logs)/ {
               deny all;

test nginx configuration

nginx -t
systemctl restart nginx

Configuration of roundcube

chown -R www-data:www-data /var/www/html/webmail/
chmod 755 /var/www/html/webmail/temp/ /var/www/html/webmail/logs/

Now you can open your browser http://your-ip-or-domain/webmail/installer to continue the installation


Facebook Comments

You may also like