mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Merge pull request #3033 from modoboa/doc-impro
documentation improvements for manual installation
This commit is contained in:
+3
-3
@@ -61,9 +61,9 @@ copyright = "2023, Antoine Nguyen" # NOQA:A001
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = "1.10"
|
||||
version = "2.2.0"
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = "1.10.0"
|
||||
release = "2.2.0"
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
@@ -107,7 +107,7 @@ pygments_style = "sphinx"
|
||||
|
||||
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
|
||||
if on_rtd:
|
||||
html_theme = "default"
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
else:
|
||||
html_theme = "nature"
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ You will need a Server to perform well with at least:
|
||||
* RAM: 2GB
|
||||
* Disk: 10GB
|
||||
* Python 3.8+
|
||||
* Postgres 12+ or MariaDB 10.4+ or MySQL 8+ or sqlite3 or LDAP
|
||||
|
||||
.. note:: **👀 Heads up for modoboa versions 1.15 and later**
|
||||
|
||||
@@ -17,6 +18,8 @@ You will need a Server to perform well with at least:
|
||||
If you still have Python 2 installed on your system either uninstall it
|
||||
or force modoboa user to run with Python 3.
|
||||
|
||||
If you want to run virus scan on your server you will need **4GB** of RAM.
|
||||
|
||||
Recommended way
|
||||
===============
|
||||
|
||||
@@ -28,7 +31,7 @@ postfix, dovecot, amavis and more) on one machine.
|
||||
|
||||
.. warning::
|
||||
|
||||
For now, only Debian and CentOS based Linux distributions are
|
||||
For now, only Debian based Linux distributions are
|
||||
supported. We do our best to improve compatibility but if you use
|
||||
another Linux or a UNIX system, you will have to install Modoboa
|
||||
:ref:`manually <by_hand>`.
|
||||
|
||||
@@ -10,6 +10,17 @@ suitable for this combination.
|
||||
In this section, we assume dovecot's configuration resides in
|
||||
:file:`/etc/dovecot`, all pathes will be relative to this directory.
|
||||
|
||||
You can find configuration documentation `here <https://doc.dovecot.org/configuration_manual/>`_.
|
||||
|
||||
This proposed configuration is the one you can find with modoboa-installer. For up to date configuration, `take a look here <https://github.com/modoboa/modoboa-installer/tree/master/modoboa_installer/scripts/files/dovecot/conf.d>`_
|
||||
|
||||
Packages
|
||||
========
|
||||
|
||||
For debian and derivative, recommended packages are::
|
||||
|
||||
apt install dovecot-imapd dovecot-lmtpd dovecot-managesieved dovecot-sieve
|
||||
|
||||
Mailboxes
|
||||
=========
|
||||
|
||||
@@ -17,12 +28,14 @@ First, edit the :file:`conf.d/10-mail.conf` and set the ``mail_location``
|
||||
variable::
|
||||
|
||||
# maildir
|
||||
mail_location = maildir:~/.maildir
|
||||
mail_location = maildir:~/Maildir
|
||||
|
||||
Then, edit the ``inbox`` namespace and add the following lines::
|
||||
Then, edit the ``inbox`` namespace and add the following line::
|
||||
|
||||
inbox = yes
|
||||
|
||||
In order for dovecot to automaticaly create usual folders on account creation, edit the ``inbox`` namespace of :file:`15-mailboxes.conf`::
|
||||
|
||||
mailbox Drafts {
|
||||
auto = subscribe
|
||||
special_use = \Drafts
|
||||
@@ -40,6 +53,14 @@ Then, edit the ``inbox`` namespace and add the following lines::
|
||||
special_use = \Trash
|
||||
}
|
||||
|
||||
Starting dovecot 2.2.20+, you can add ``autoexpunge`` parameter to delete older message, for instance::
|
||||
|
||||
mailbox Trash {
|
||||
auto = subscribe
|
||||
special_use = \Trash
|
||||
autoexpunge=30d
|
||||
}
|
||||
|
||||
With dovecot 2.1+, it ensures all the special mailboxes will be
|
||||
automaticaly created for new accounts.
|
||||
|
||||
@@ -79,11 +100,11 @@ executed (see :ref:`Postfix configuration <postfix_config>`).
|
||||
|
||||
Edit the crontab of the user who owns the mailboxes on the file system::
|
||||
|
||||
$ crontab -u <user> -e
|
||||
$ crontab -u <vmail_user> -e
|
||||
|
||||
And add the following line inside::
|
||||
|
||||
* * * * * python <modoboa_site>/manage.py handle_mailbox_operations
|
||||
* * * * * python <modoboa_instance>/manage.py handle_mailbox_operations
|
||||
|
||||
.. warning::
|
||||
|
||||
@@ -139,6 +160,9 @@ to your database engine.
|
||||
MySQL users
|
||||
-----------
|
||||
|
||||
For debian and derivative, you need to install mysql connector for dovecot::
|
||||
sudo apt install dovecot-mysql
|
||||
|
||||
::
|
||||
|
||||
driver = mysql
|
||||
@@ -169,6 +193,9 @@ MySQL users
|
||||
PostgreSQL users
|
||||
----------------
|
||||
|
||||
For debian and derivative, you need to install postgres connector for dovecot::
|
||||
sudo apt install dovecot-pgsql
|
||||
|
||||
::
|
||||
|
||||
driver = pgsql
|
||||
@@ -197,6 +224,9 @@ PostgreSQL users
|
||||
SQLite users
|
||||
------------
|
||||
|
||||
For debian and derivative, you need to install sqlite connector for dovecot::
|
||||
sudo apt install dovecot-sqlite
|
||||
|
||||
::
|
||||
|
||||
driver = sqlite
|
||||
@@ -233,12 +263,12 @@ You should comment the userdb section, which will be managed by SQL with modoboa
|
||||
args = /etc/dovecot/dovecot-ldap.conf.ext
|
||||
}
|
||||
|
||||
#userdb {
|
||||
#driver = ldap
|
||||
#args = /etc/dovecot/dovecot-ldap.conf.ext
|
||||
|
||||
#userdb {
|
||||
#driver = ldap
|
||||
#args = /etc/dovecot/dovecot-ldap.conf.ext
|
||||
|
||||
# Default fields can be used to specify defaults that LDAP may override
|
||||
#default_fields = home=/home/virtual/%u
|
||||
#default_fields = home=/home/virtual/%u
|
||||
#}
|
||||
|
||||
Your own dovecot LDAP configuration file is now :file:`/etc/dovecot/dovecot-ldap.conf.ext`.
|
||||
@@ -249,7 +279,7 @@ Synchronize dovecot LDAP conf with modoboa LDAP conf
|
||||
|
||||
To make dovecot LDAP configuration synchronized with modoboa LDAP configuration, you should create a dedicated dovecot conf file.
|
||||
At the end of your dovecot configuration file (:file:`dovecot-ldap.conf.ext`), add the following line::
|
||||
|
||||
|
||||
!include_try dovecot-modoboa.conf.ext
|
||||
|
||||
Then, set modoboa parameter *Enable Dovecot LDAP sync* to *Yes*.
|
||||
@@ -401,7 +431,7 @@ execute the following commands::
|
||||
$ su - postgres
|
||||
$ psql [modoboa database] < /path/to/modoboa_postgres_trigger.sql
|
||||
$ exit
|
||||
|
||||
|
||||
Replace ``[modoboa database]`` by the appropriate value.
|
||||
|
||||
Forcing recalculation
|
||||
@@ -438,15 +468,6 @@ uncommented::
|
||||
# ...
|
||||
}
|
||||
|
||||
Messages filtering using Sieve is done by the LDA.
|
||||
|
||||
Inside :file:`conf.d/15-lda.conf`, activate the ``sieve`` plugin like this::
|
||||
|
||||
protocol lda {
|
||||
# Space separated list of plugins to load (default is global mail_plugins).
|
||||
mail_plugins = $mail_plugins sieve
|
||||
}
|
||||
|
||||
Finally, configure the ``sieve`` plugin by editing the
|
||||
:file:`conf.d/90-sieve.conf` file. Put the follwing caontent inside::
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ Modoboa
|
||||
This section describes the installation of the web interface (a
|
||||
`Django <https://www.djangoproject.com/>`_ project).
|
||||
|
||||
This proposed configuration is the one you can find with modoboa-installer. For up to date configuration, `take a look here <https://github.com/modoboa/modoboa-installer/tree/master/modoboa_installer/scripts/files/modoboa/>`_
|
||||
|
||||
|
||||
Prepare the system
|
||||
------------------
|
||||
|
||||
@@ -25,7 +28,7 @@ distributions using `virtualenv <https://virtualenv.pypa.io/en/stable/>`_:
|
||||
|
||||
# apt-get install virtualenv python3-pip
|
||||
# useradd modoboa # create a dedicated user
|
||||
# su -l modoboa # log in as the newly created user
|
||||
# sudo -u modoboa -i bash # log in as the newly created user
|
||||
$ virtualenv --python python3 ./env # create the virtual environment
|
||||
$ source ./env/bin/activate # activate the virtual environment
|
||||
|
||||
@@ -40,6 +43,7 @@ following system packages according to your distribution:
|
||||
| libxml2-dev libxslt-dev |
|
||||
| libjpeg-dev librrd-dev |
|
||||
| rrdtool libffi-dev libssl-dev |
|
||||
| pkg-config libcairo2-dev |
|
||||
+-------------------------------+
|
||||
|
||||
+-----------------------------+
|
||||
@@ -99,13 +103,13 @@ Install the corresponding Python binding:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
(env)$ pip install psycopg2
|
||||
(env)$ pip install psycopg[binary]>=3.1
|
||||
|
||||
.. note::
|
||||
|
||||
Alternatively, you can install the ``python3-psycopg2`` package instead on
|
||||
Debian-based distributions if your virtual environment was created with
|
||||
``--system-site-packages`` option.
|
||||
Ubuntu and Debian repositories contain python-psycopgX package
|
||||
but starting modoboa 2.2.0 minimum version required is 3.1 and
|
||||
it has not yet it these distro yet
|
||||
Prior modoboa version can run with ``python3-psycopg2``.
|
||||
|
||||
Then, create a user and a database. For example, to create the ``modoboa``
|
||||
database owned by a ``modoboa`` user, run the following commands on your
|
||||
@@ -169,7 +173,8 @@ you just have to run the following command:
|
||||
If you choose to install extensions one at a time, you will have to
|
||||
add their names in settings.py to ``MODOBOA_APPS``. Also ensure that
|
||||
you have the line ``from modoboa_amavis.settings import *`` at the
|
||||
end of this file.
|
||||
end of this file and possibly perform more steps. Check the
|
||||
documentation/readme of each extensions for specific Instructions.
|
||||
|
||||
The list of available extensions can be found on the :doc:`index
|
||||
page <../index>`. Instructions to install them are available on
|
||||
@@ -226,15 +231,15 @@ following content inside:
|
||||
INSTANCE=<path to Modoboa instance>
|
||||
|
||||
# Operations on mailboxes
|
||||
* * * * * vmail $PYTHON $INSTANCE/manage.py handle_mailbox_operations
|
||||
* * * * * <mailbox user> $PYTHON $INSTANCE/manage.py handle_mailbox_operations
|
||||
|
||||
# Generate DKIM keys (they will belong to the user running this job)
|
||||
* * * * * root umask 077 && $PYTHON $INSTANCE/manage.py modo manage_dkim_keys
|
||||
|
||||
# Sessions table cleanup
|
||||
0 0 * * * modoboa $PYTHON $INSTANCE/manage.py clearsessions
|
||||
0 0 * * * root $PYTHON $INSTANCE/manage.py clearsessions
|
||||
# Logs table cleanup
|
||||
0 0 * * * modoboa $PYTHON $INSTANCE/manage.py cleanlogs
|
||||
0 0 * * * root $PYTHON $INSTANCE/manage.py cleanlogs
|
||||
# Logs parsing
|
||||
*/15 * * * * root $PYTHON $INSTANCE/manage.py logparser &> /dev/null
|
||||
0 * * * * modoboa $PYTHON $INSTANCE/manage.py update_statistics
|
||||
@@ -271,14 +276,13 @@ You can launch it manually using the following command:
|
||||
|
||||
But we recommend an automatic start using ``systemd`` or
|
||||
``supervisor``. Here is a configuration example for ``supervisor``:
|
||||
|
||||
.. sourcecode:: ini
|
||||
|
||||
[program:policyd]
|
||||
autostart=true
|
||||
autorestart=true
|
||||
command=/srv/modoboa/env/bin/python /srv/modoboa/instance/manage.py policy_daemon
|
||||
directory=/srv/modoboa
|
||||
command=<path to Python binary inside the virtual environment> <path to Modoboa instance>/manage.py policy_daemon
|
||||
directory=<modoboa user home dir>
|
||||
redirect_stderr=true
|
||||
user=modoboa
|
||||
numprocs=1
|
||||
|
||||
@@ -30,35 +30,57 @@ stored. Answer the few questions and you're done.
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Use the following configuration in the :file:`/etc/postfix/main.cf` file
|
||||
Use the following configuration in the :file:`/etc/postfix/main.cf` file. For TLS configuration, you can look at the
|
||||
`used configuration <https://github.com/modoboa/modoboa-installer/blob/master/modoboa_installer/scripts/files/postfix/main.cf.tpl>`_
|
||||
for `modoboa installer <https://github.com/modoboa/modoboa-installer>`_.
|
||||
(this is just one possible configuration)::
|
||||
|
||||
# Stuff before
|
||||
unknown_local_recipient_reject_code = 550
|
||||
unverified_recipient_reject_code = 550
|
||||
|
||||
# appending .domain is the MUA's job.
|
||||
append_dot_mydomain = no
|
||||
|
||||
## Proxy maps
|
||||
proxy_read_maps =
|
||||
proxy:unix:passwd.byname
|
||||
proxy:<driver>:/etc/postfix/sql-domains.cf
|
||||
proxy:<driver>:/etc/postfix/sql-domain-aliases.cf
|
||||
proxy:<driver>:/etc/postfix/sql-aliases.cf
|
||||
proxy:<driver>:/etc/postfix/sql-relaydomains.cf
|
||||
proxy:<driver>:/etc/postfix/sql-maintain.cf
|
||||
proxy:<driver>:/etc/postfix/sql-relay-recipient-verification.cf
|
||||
proxy:<driver>:/etc/postfix/sql-sender-login-map.cf
|
||||
proxy:<driver>:/etc/postfix/sql-spliteddomains-transport.cf
|
||||
proxy:<driver>:/etc/postfix/sql-transport.cf
|
||||
|
||||
## Virtual transport settings
|
||||
virtual_transport = lmtp:unix:private/dovecot-lmtp
|
||||
|
||||
virtual_mailbox_domains = <driver>:/etc/postfix/sql-domains.cf
|
||||
virtual_alias_domains = <driver>:/etc/postfix/sql-domain-aliases.cf
|
||||
virtual_alias_maps = <driver>:/etc/postfix/sql-aliases.cf
|
||||
virtual_mailbox_domains = proxy:<driver>:/etc/postfix/sql-domains.cf
|
||||
virtual_alias_domains = proxy:<driver>:/etc/postfix/sql-domain-aliases.cf
|
||||
virtual_alias_maps = proxy:<driver>:/etc/postfix/sql-aliases.cf
|
||||
|
||||
relay_domains = <driver>:/etc/postfix/sql-relaydomains.cf
|
||||
## Relay domains
|
||||
relay_domains = proxy:<driver>:/etc/postfix/sql-relaydomains.cf
|
||||
transport_maps =
|
||||
<driver>:/etc/postfix/sql-transport.cf
|
||||
<driver>:/etc/postfix/sql-spliteddomains-transport.cf
|
||||
proxy:<driver>:/etc/postfix/sql-transport.cf
|
||||
proxy:<driver>:/etc/postfix/sql-spliteddomains-transport.cf
|
||||
|
||||
smtpd_recipient_restrictions =
|
||||
# ...
|
||||
check_recipient_access
|
||||
<driver>:/etc/postfix/sql-maintain.cf
|
||||
<driver>:/etc/postfix/sql-relay-recipient-verification.cf
|
||||
permit_mynetworks
|
||||
reject_unauth_destination
|
||||
permit_sasl_authenticated
|
||||
check_recipient_access
|
||||
proxy:<driver>:/etc/postfix/sql-maintain.cf
|
||||
proxy:<driver>:/etc/postfix/sql-relay-recipient-verification.cf
|
||||
reject_unverified_recipient
|
||||
# ...
|
||||
reject_unauth_destination
|
||||
reject_non_fqdn_sender
|
||||
reject_non_fqdn_recipient
|
||||
reject_non_fqdn_helo_hostname
|
||||
|
||||
smtpd_sender_login_maps = <driver>:/etc/postfix/sql-sender-login-map.cf
|
||||
|
||||
smtpd_sender_restrictions =
|
||||
reject_sender_login_mismatch
|
||||
smtpd_sender_login_maps = proxy:<driver>:/etc/postfix/sql-sender-login-map.cf
|
||||
|
||||
# Stuff after
|
||||
|
||||
|
||||
@@ -23,39 +23,56 @@ First, make sure that ``mod_wsgi`` is installed on your server.
|
||||
Create a new virtualhost in your Apache configuration and put the
|
||||
following content inside::
|
||||
|
||||
WSGIPythonHome /var/www/modoboa/env
|
||||
WSGIPythonPath /var/www/modoboa/instance
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName <your value>
|
||||
DocumentRoot <modoboa_instance_path>
|
||||
|
||||
DocumentRoot <modoboa_instance_path>
|
||||
|
||||
Alias /media/ <modoboa_instance_path>/media/
|
||||
<Directory <modoboa_instance_path>/media>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
<Directory <modoboa_instance_path>/media/>
|
||||
Options FollowSymLinks
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
Alias /sitestatic/ <modoboa_instance_path>/sitestatic/
|
||||
<Directory <modoboa_instance_path>/sitestatic>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
<Directory <modoboa_instance_path>/sitestatic/>
|
||||
Options FollowSymLinks
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
WSGIScriptAlias / <modoboa_instance_path>/<instance_name>/wsgi.py
|
||||
Alias /new-admin <modoboa_instance_path>/frontend
|
||||
<Directory <modoboa_instance_path>/frontend>
|
||||
Options FollowSymLinks
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
WSGIScriptAlias / <modoboa_instance_path>/instance/wsgi.py
|
||||
WSGIApplicationGroup %{GLOBAL}
|
||||
|
||||
# Pass Authorization header to enable API usage:
|
||||
WSGIPassAuthorization On
|
||||
|
||||
LogLevel info
|
||||
</VirtualHost>
|
||||
|
||||
This is just one possible configuration.
|
||||
|
||||
To use mod_wsgi daemon mode, add the two following directives just
|
||||
under ``WSGIScriptAlias``::
|
||||
|
||||
WSGIDaemonProcess example.com python-path=<modoboa_instance>:<virtualenv path>/lib/python3.7/site-packages
|
||||
WSGIProcessGroup example.com
|
||||
|
||||
Replace values between ``<>`` with yours. If you don't use a
|
||||
`virtualenv <http://virtualenv.readthedocs.org/en/latest/>`_, just
|
||||
remove the last part of the ``WSGIDaemonProcess`` directive.
|
||||
.. note::
|
||||
|
||||
You may need to add::
|
||||
import sys
|
||||
|
||||
sys.path.append('<modoboa_instance_path>')
|
||||
sys.path.append('<modoboa_venv_path>/bin')
|
||||
sys.path.append('<modoboa_venv_path>/lib/python3.X/site-packages')
|
||||
|
||||
in :file:`<modoboa_instance_path>/instance/wsgi.py`.
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -77,6 +94,162 @@ the one you prefer between `Green Unicorn <http://gunicorn.org/>`_ or
|
||||
In both cases, you'll need to download and `install nginx
|
||||
<http://wiki.nginx.org/Install>`_.
|
||||
|
||||
uWSGI
|
||||
+++++
|
||||
|
||||
The following setup is meant to get you started quickly. You should
|
||||
read the documentation of both nginx and uwsgi to understand how to
|
||||
optimize their configuration for your site.
|
||||
|
||||
The Django documentation includes the following warning regarding
|
||||
uwsgi:
|
||||
|
||||
.. warning::
|
||||
|
||||
Use uwsgi 1.2.6 or newer. If you do not, you *will* run into
|
||||
problems. Modoboa will fail in obscure ways.
|
||||
|
||||
To use this setup, first `download and install uwsgi
|
||||
<http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html>`_.
|
||||
|
||||
Recommend packages for debian and derivatives::
|
||||
|
||||
apt install uwsgi uwsgi-plugin-python3
|
||||
|
||||
Here is a sample nginx configuration::
|
||||
|
||||
upstream modoboa {
|
||||
server unix:<uwsgi_socket_path> fail_timeout=0;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name <hostname>;
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
server_name <hostname>;
|
||||
root <modoboa_instance_path>;
|
||||
|
||||
ssl_certificate <ssl certificate for your site>;
|
||||
ssl_certificate_key <ssl certificate key for your site>;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384";
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_verify_depth 3;
|
||||
ssl_dhparam /etc/nginx/dhparam.pem;
|
||||
|
||||
client_max_body_size 10M;
|
||||
|
||||
access_log /var/log/nginx/modoboa-access.log;
|
||||
error_log /var/log/nginx/modoboa-error.log;
|
||||
|
||||
location /sitestatic/ {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location ^~ /new-admin {
|
||||
alias <modoboa_instance_path>/frontend/;
|
||||
index index.html;
|
||||
|
||||
expires -1;
|
||||
add_header Pragma "no-cache";
|
||||
add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
|
||||
|
||||
try_files $uri $uri/ /index.html = 404;
|
||||
}
|
||||
|
||||
location / {
|
||||
include uwsgi_params;
|
||||
uwsgi_param UWSGI_SCRIPT instance.wsgi:application;
|
||||
uwsgi_pass modoboa;
|
||||
}
|
||||
%{extra_config}
|
||||
}
|
||||
|
||||
``<modoboa instance name>``, ``<hostname>``, ``<modoboa_instance_path>`` and ``<ssl...>`` must be replaced by the value you used.
|
||||
``<uwsgi_socket_path>``
|
||||
|
||||
|
||||
when :ref:`you deployed your instance <deployment>`.
|
||||
|
||||
If you do not plan to use SSL then change the listen directive to
|
||||
``listen 80;`` and delete each of the following directives::
|
||||
|
||||
ssl on;
|
||||
keepalive_timeout 70;
|
||||
ssl_certificate <ssl certificate for your site>;
|
||||
ssl_certificate_key <ssl certificate key for your site>;
|
||||
uwsgi_param UWSGI_SCHEME https;
|
||||
|
||||
If you do plan to use SSL, you'll have to generate a certificate and a
|
||||
key. `This article
|
||||
<http://wiki.nginx.org/HttpSslModule#Generate_Certificates>`_
|
||||
contains information about how to do it.
|
||||
|
||||
Make sure to replace the ``<...>`` in the sample configuration with
|
||||
appropriate values. Here are some explanations for the cases that may
|
||||
not be completely self-explanatory:
|
||||
|
||||
``<hostname>``
|
||||
This is the URL which will be the root of your Modoboa site at your
|
||||
domain. For instance, if your Modoboa installation is reachable at
|
||||
at ``https://foo/modoboa`` then ``<hostname>`` is
|
||||
``/modoboa``. In this case you probably also have to set the
|
||||
``alias`` directives to point to where Modoboa's sitestatic and
|
||||
media directories are because otherwise nginx won't be able to find
|
||||
them.
|
||||
|
||||
If Modoboa is at the root of your domain, then ``<hostname>``
|
||||
is an empty string and can be deleted from the configuration
|
||||
above. In this case, you probably do not need the ``alias``
|
||||
directives.
|
||||
|
||||
``<uwsgi_socket_path>``
|
||||
The location where uwsig is listening. It could be a unix domain
|
||||
socket or an address:port combination. Ubuntu configures uwsgi so
|
||||
that the port is::
|
||||
|
||||
unix:/run/uwsgi/app/<app name>/socket
|
||||
|
||||
where ``<app name>`` is the name of the application.
|
||||
|
||||
Your uwsgi configuration should be::
|
||||
|
||||
[uwsgi]
|
||||
# Not needed when using uwsgi from pip
|
||||
# plugins = python
|
||||
chdir = <modoboa_instance_path>
|
||||
module = <name>.wsgi:application
|
||||
master = true
|
||||
harakiri = 60
|
||||
processes = 4
|
||||
vhost = true
|
||||
no-default-app = true
|
||||
|
||||
The plugins directive should be turned on if you use a uwsgi
|
||||
installation that requires it. If uwsgi was installed from pip, it
|
||||
does not require it. In the configuration above:
|
||||
|
||||
``<modoboa_instance_path>``
|
||||
The directory where :file:`manage.py` resides. This directory is the
|
||||
parent of ``<modoboa's settings dir>``
|
||||
|
||||
``<name>``
|
||||
The name that you passed to ``modoboa-admin.py deploy`` when you
|
||||
created your Modoboa instance, usually ``instance``.
|
||||
|
||||
Now, you can go the :ref:`dovecot` section to continue the installation.
|
||||
|
||||
Green Unicorn
|
||||
+++++++++++++
|
||||
|
||||
@@ -155,140 +328,3 @@ Paste this content to your configuration (replace values between
|
||||
``<>`` with yours) and restart nginx.
|
||||
|
||||
Now, you can go the :ref:`dovecot` section to continue the installation.
|
||||
|
||||
uWSGI
|
||||
+++++
|
||||
|
||||
The following setup is meant to get you started quickly. You should
|
||||
read the documentation of both nginx and uwsgi to understand how to
|
||||
optimize their configuration for your site.
|
||||
|
||||
The Django documentation includes the following warning regarding
|
||||
uwsgi:
|
||||
|
||||
.. warning::
|
||||
|
||||
Use uwsgi 1.2.6 or newer. If you do not, you *will* run into
|
||||
problems. Modoboa will fail in obscure ways.
|
||||
|
||||
To use this setup, first `download and install uwsgi
|
||||
<http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html>`_.
|
||||
|
||||
Here is a sample nginx configuration::
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
ssl on;
|
||||
keepalive_timeout 70;
|
||||
|
||||
server_name <host fqdn>;
|
||||
root <modoboa's settings dir>;
|
||||
|
||||
ssl_certificate <ssl certificate for your site>;
|
||||
ssl_certificate_key <ssl certificate key for your site>;
|
||||
|
||||
access_log /var/log/nginx/<host fqdn>.access.log;
|
||||
error_log /var/log/nginx/<host fqdn>.error.log;
|
||||
|
||||
location <modoboa's root url>/sitestatic/ {
|
||||
autoindex on;
|
||||
alias <location of sitestatic on your file system>;
|
||||
}
|
||||
|
||||
# Whether or not Modoboa uses a media directory depends on how
|
||||
# you configured Modoboa. It does not hurt to have this.
|
||||
location <modoboa's root url>/media/ {
|
||||
autoindex on;
|
||||
alias <location of media on your file system>;
|
||||
}
|
||||
|
||||
# This denies access to any file that begins with
|
||||
# ".ht". Apache's .htaccess and .htpasswd are such files. A
|
||||
# Modoboa installed from scratch would not contain any such
|
||||
# files, but you never know what the future holds.
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location <modoba's root url>/ {
|
||||
include uwsgi_params;
|
||||
uwsgi_pass <uwsgi port>;
|
||||
uwsgi_param UWSGI_SCRIPT <modoboa instance name>.wsgi:application;
|
||||
uwsgi_param UWSGI_SCHEME https;
|
||||
}
|
||||
}
|
||||
|
||||
``<modoboa instance name>`` must be replaced by the value you used
|
||||
when :ref:`you deployed your instance <deployment>`.
|
||||
|
||||
If you do not plan to use SSL then change the listen directive to
|
||||
``listen 80;`` and delete each of the following directives::
|
||||
|
||||
ssl on;
|
||||
keepalive_timeout 70;
|
||||
ssl_certificate <ssl certificate for your site>;
|
||||
ssl_certificate_key <ssl certificate key for your site>;
|
||||
uwsgi_param UWSGI_SCHEME https;
|
||||
|
||||
If you do plan to use SSL, you'll have to generate a certificate and a
|
||||
key. `This article
|
||||
<http://wiki.nginx.org/HttpSslModule#Generate_Certificates>`_
|
||||
contains information about how to do it.
|
||||
|
||||
Make sure to replace the ``<...>`` in the sample configuration with
|
||||
appropriate values. Here are some explanations for the cases that may
|
||||
not be completely self-explanatory:
|
||||
|
||||
``<modoboa's settings dir>``
|
||||
Where Modoboa's :file:`settings.py` resides. This is also where the
|
||||
:file:`sitestatic` and :file:`media` directories reside.
|
||||
|
||||
``<modoboa's root url>``
|
||||
This is the URL which will be the root of your Modoboa site at your
|
||||
domain. For instance, if your Modoboa installation is reachable at
|
||||
at ``https://foo/modoboa`` then ``<modoboa's root url>`` is
|
||||
``/modoboa``. In this case you probably also have to set the
|
||||
``alias`` directives to point to where Modoboa's sitestatic and
|
||||
media directories are because otherwise nginx won't be able to find
|
||||
them.
|
||||
|
||||
If Modoboa is at the root of your domain, then ``<modoboa root
|
||||
url>`` is an empty string and can be deleted from the configuration
|
||||
above. In this case, you probably do not need the ``alias``
|
||||
directives.
|
||||
|
||||
``<uwsgi port>``
|
||||
The location where uwsig is listening. It could be a unix domain
|
||||
socket or an address:port combination. Ubuntu configures uwsgi so
|
||||
that the port is::
|
||||
|
||||
unix:/run/uwsgi/app/<app name>/socket
|
||||
|
||||
where ``<app name>`` is the name of the application.
|
||||
|
||||
Your uwsgi configuration should be::
|
||||
|
||||
[uwsgi]
|
||||
# Not needed when using uwsgi from pip
|
||||
# plugins = python
|
||||
chdir = <modoboa's top dir>
|
||||
module = <name>.wsgi:application
|
||||
master = true
|
||||
harakiri = 60
|
||||
processes = 4
|
||||
vhost = true
|
||||
no-default-app = true
|
||||
|
||||
The plugins directive should be turned on if you use a uwsgi
|
||||
installation that requires it. If uwsgi was installed from pip, it
|
||||
does not require it. In the configuration above:
|
||||
|
||||
``<modoboa's top dir>``
|
||||
The directory where :file:`manage.py` resides. This directory is the
|
||||
parent of ``<modoboa's settings dir>``
|
||||
|
||||
``<name>``
|
||||
The name that you passed to ``modoboa-admin.py deploy`` when you
|
||||
created your Modoboa instance.
|
||||
|
||||
Now, you can go the :ref:`dovecot` section to continue the installation.
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
docutils<0.21
|
||||
sphinx_rtd_theme
|
||||
|
||||
+7
-11
@@ -206,33 +206,29 @@ Send-only mailboxes do not have access to IMAP.
|
||||
You need to change your dovecot configuration to enable it.
|
||||
|
||||
.. note::
|
||||
|
||||
modoboa-webmail may not work with send-only user for now.
|
||||
|
||||
If you use ``Postgres``:
|
||||
Change ``user_query`` and ``password_query`` in ``/etc/dovecot/dovecot-sql.conf.ext``:
|
||||
Change ``user_query`` and ``password_query`` in ``/etc/dovecot/dovecot-sql.conf.ext``::
|
||||
|
||||
.. sourcecode::
|
||||
user_query = SELECT '%{home_dir}/%%d/%%n' AS home, %mailboxes_owner_uid as uid, %mailboxes_owner_gid as gid, '*:bytes=' || mb.quota || 'M' AS quota_rule FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN core_user u ON u.id=mb.user_id WHERE (mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND mb.address='%%n' AND dom.name='%%d'
|
||||
|
||||
user_query = SELECT '%{home_dir}/%%d/%%n' AS home, %mailboxes_owner_uid as uid, %mailboxes_owner_gid as gid, '*:bytes=' || mb.quota || 'M' AS quota_rule FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN core_user u ON u.id=mb.user_id WHERE (mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND mb.address='%%n' AND dom.name='%%d'
|
||||
|
||||
password_query = SELECT email AS user, password, '%{home_dir}/%%d/%%n' AS userdb_home, %mailboxes_owner_uid AS userdb_uid, %mailboxes_owner_gid AS userdb_gid, CONCAT('*:bytes=', mb.quota, 'M') AS userdb_quota_rule FROM core_user u INNER JOIN admin_mailbox mb ON u.id=mb.user_id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE (mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3')) AND email='%%u' AND is_active AND dom.enabled
|
||||
password_query = SELECT email AS user, password, '%{home_dir}/%%d/%%n' AS userdb_home, %mailboxes_owner_uid AS userdb_uid, %mailboxes_owner_gid AS userdb_gid, CONCAT('*:bytes=', mb.quota, 'M') AS userdb_quota_rule FROM core_user u INNER JOIN admin_mailbox mb ON u.id=mb.user_id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE (mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3')) AND email='%%u' AND is_active AND dom.enabled
|
||||
|
||||
|
||||
You basically simply need to add ``(mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND`` for ``user_query`` after ``WHERE`` and ``(mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3')) AND`` for ``password_query`` after ``WHERE``.
|
||||
|
||||
|
||||
If you use ``MySQL``:
|
||||
Change ``user_query`` and ``password_query`` in ``/etc/dovecot/dovecot-sql-master.ext``:
|
||||
Change ``user_query`` and ``password_query`` in ``/etc/dovecot/dovecot-sql-master.ext``::
|
||||
|
||||
.. sourcecode::
|
||||
user_query = SELECT '%{home_dir}/%%d/%%n' AS home, %mailboxes_owner_uid as uid, %mailboxes_owner_gid as gid, CONCAT('*:bytes=', mb.quota, 'M') AS quota_rule FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN core_user u ON u.id=mb.user_id WHERE (mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND mb.address='%%n' AND dom.name='%%d'
|
||||
|
||||
user_query = SELECT '%{home_dir}/%%d/%%n' AS home, %mailboxes_owner_uid as uid, %mailboxes_owner_gid as gid, CONCAT('*:bytes=', mb.quota, 'M') AS quota_rule FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN core_user u ON u.id=mb.user_id WHERE (mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND mb.address='%%n' AND dom.name='%%d'
|
||||
|
||||
password_query = SELECT email AS user, password, '%{home_dir}/%%d/%%n' AS userdb_home, %mailboxes_owner_uid AS userdb_uid, %mailboxes_owner_gid AS userdb_gid, CONCAT('*:bytes=', mb.quota, 'M') AS userdb_quota_rule FROM core_user u INNER JOIN admin_mailbox mb ON u.id=mb.user_id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE (mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3')) AND u.email='%%u' AND u.is_active=1 AND dom.enabled=1
|
||||
password_query = SELECT email AS user, password, '%{home_dir}/%%d/%%n' AS userdb_home, %mailboxes_owner_uid AS userdb_uid, %mailboxes_owner_gid AS userdb_gid, CONCAT('*:bytes=', mb.quota, 'M') AS userdb_quota_rule FROM core_user u INNER JOIN admin_mailbox mb ON u.id=mb.user_id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE (mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3')) AND u.email='%%u' AND u.is_active=1 AND dom.enabled=1
|
||||
|
||||
You basically simply need to add ``(mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND`` for ``user_query`` after ``WHERE`` and ``(mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3'))`` for ``password_query`` after ``WHERE``.
|
||||
|
||||
|
||||
2.1.0
|
||||
=====
|
||||
|
||||
|
||||
Reference in New Issue
Block a user