:PROPERTIES:
:ID:       a9e9ba39-726e-4a49-876e-a0d58623cc48
:mtime:    20220527130858
:ctime:    20220526105643
:END:
#+title: Roundcube

* Introduction

* Installation
** Configuration de nginx
# Configure nginx
#+BEGIN_SRC shell
cat >/etc/nginx/sites-available/mail <<EOF
server {
    server_name mail.adrien.run;

    access_log /var/log/nginx/mail.access.log;
    error_log  /var/log/nginx/mail.error.log;

    root /var/lib/roundcube;
    index index.php;

    location / {
       try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    location ~ ^/(README.md|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
       deny all;
    }

    location ~ ^/(config|temp|logs)/ {
       deny all;
    }

    location ~ /\. {
       deny all;
       access_log off;
       log_not_found off;
    }

    location ~ \.php$ {
       try_files $uri =404;
       fastcgi_pass unix:/var/run/php/php-fpm.sock;
       fastcgi_index index.php;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       include fastcgi_params;
    }

    add_header Strict-Transport-Security "max-age=31536000";

    listen 443 ssl;
}
server {
    if ($host = mail.adrien.run) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    server_name mail.adrien.run;
    listen 80;
    return 404; # managed by Certbot
}
	EOF
ln -s /etc/nginx/sites-available/mail /etc/nginx/sites-enabled/mail
certbot --nginx -d mail.adrien.run
#+END_SRC
** Installation et configuration
#+BEGIN_SRC shell
apt-get install roundcube roundcube-pgsql
#+END_SRC
Pour reconfigurer /roundcube/ :
#+BEGIN_SRC shell
dpkg-reconfigure roundcube-core
#+END_SRC
#+BEGIN_SRC shell
cat >/etc/roundcube/debian-db.php <<EOF
$dbuser='roundcube';
$dbpass='<password>';
$basepath='';
$dbname='roundcubemail';
$dbserver='localhost';
$dbport='';
$dbtype='pgsql';
EOF
#+END_SRC
Modifier les lignes suivantes dans le fichier ~/etc/roundcube/config.inc.php~ :
#+BEGIN_SRC php
$config['default_host'] = array("tls://imap.adrien.run");
$config['smtp_server'] = 'smtp.adrien.run';
#+END_SRC

* Références
