Translation(s): English - Francais

This page provides information about the installation and configuration of the xmpp server prosody (a jabber server) on Debian.

The XMPP service will be offered on the host named with TLS encryption.

Before starting make sure actually points to the public IP of the host (cf. DNS records).

In addition, the port 5222 and 5269 are open to the public IP.


Installation of prosody

is with aptitude or apt, for example:

aptitude install prosody


The files

Are in /etc/prosody


Configuration is done in the « /etc/prosody ». Similar to the model of apache there is a global configuration file « prosody.cfg.lua » and different files for each VirtualHosts in the directory « conf.avail/ ».

By default two examples of hosts configurations files are to be found in that directory: « localhost.cfg.lua » and « ». However, only localhost is activated upon installation.

A configuration file must have the extension lua.

Keep the extension if you rename or create files.

The configuration files which are actually read by prosody are in « /etc/prosody/conf.d/ ».

Typically the files in « conf.d » are symbolic links to a file in « conf.avail ».

Installing modules

SSL Encryption

The key / certificate pair for encryption between client / server and server / server is in « /etc/prosody/certs/ ». During installation the files localhost.cert and localhost.key are created, which are valid only for localhost, since you do not have a specific configuration for openssl yet ("/etc/ssl/openssl.cnf").

If you already have the files for just point the configuration above. Else you will have to create them.

The creation of a key / certificate pair is not the subject of this page, for that refer to the documentation of OpenSSL.

For example for a self-signed certificate:

openssl genrsa -out /etc/prosody/certs/ 2048
openssl req -new -x509 -key /etc/prosody/certs/ -out /etc/prosody/certs/ -days 1095

The footprint md5/sha1 (to distribute to your users to control the identity of the server during the first connection)

openssl x509 -fingerprint -md5 -in /etc/prosody/certs/
openssl x509 -fingerprint -sha1 -in /etc/prosody/certs/

If you are using a certificate that is valid only for a short term like those provided by (3 month validity), you may want to enable reload_modules module and add reload_modules = { "tls" } to your config. this should reload the cert when you reload prosody.

Declaring host

The configuration of the host will be done in the file « /etc/prosody/conf.avail/ », the file may serve as a model:

cp -a /etc/prosody/conf.avail/ /etc/prosody/conf.avail/

With your favorite editor change the settings for VirtualHost and enabled so you have:

VirtualHost ""
          --enabled = false -- Remove this line to enable this host

The line "- enabled = [...]" can also be removed, instead of adding the comment like above.

Also represent the key and the SSL certificate:

          ssl = {
                  key = "/etc/prosody/certs/";
                  certificate = "/etc/prosody/certs/";

If you already have a key / certificate pair on the same domain name (Common Name), for example for apache, point to it instead of the files listed above.

Now create the symbolic link in« /etc/prosody/conf.d/ » with:

ln -sf /etc/prosody/conf.avail/ /etc/prosody/conf.d/

Several host by one configuration

Here is an example to declare a single configuration for multiple hosts (thank you MattJ):

for _, host in ipairs { "", "" } do
   VirtualHost (host)
      option1 = "foo"
      option2 = "bar"

Create users (single)

Creating user accounts is done with the command « prosodyctl »

prosodyctl adduser

Other authentication methods (Advanced)

Cyrus SASL with LDAP

The advantage of this method is to be able to configure the user accounts reported/managed independently of prosody, namely via LDAP. The official documentation is to be found at the prosody site.

First install the packages required for authentication with sasl prosody.

aptitude install sasl2-bin lua-cyrussasl libsasl2-modules-ldap

Declare the use of Cyrus SASL as authentication method in « /etc/prosody/prosody.cfg.lua »:

authentication = "cyrus" -- (prosody 0.9+)                    
cyrus_application_name = "xmpp"

In « /etc/default/saslautd » change START=no to START=yes and control it by MECHANISMS="ldap". Also MECH_OPTIONS must point to a file, probably « /etc/saslauthd.conf ».

Then it is necessary to configure options for the mechanisms of authentication. This is done in the file indicated by MECH_OPTIONS (generally in « /etc/saslauthd.conf »). To do this edit the file and insert the following:

ldap_servers: ldap://
ldap_search_base: ou=user,dc=example,dc=org

Restart the service:

service saslauthd restart

Test if it works correct:

$ testsaslauthd -u utilisateur -p mot_de_passe
0: OK "Success."

Hint: first run the above command as the sasl user (or root) to make sure that sasl is configured correctly. Then run as the prosody user to make sure that prosody can authenticate using sasl (add prosody to sasl group).

Declare the service in «/etc/sasl/xmpp.conf». The directory /etc/sasl might not yet exist. The filename corresponds to the value entered for the "cyrus_application_name" in the configuration of prosody.

pwcheck_method: saslauthd
mech_list: PLAIN

If this file does not exist or has the wrong filename, then /var/log/auth.log outputs messages like "NTLM server step 1" which indicate that the above mech_list is not used.

Useful Modules (Mobile support)

There are many modules available for prosody that adds more useful features. Namely

With prosody 0.10 (via nightly builds from Note: These modules need sql storage backend

Add sql backend for storage module, and storage == "sql" should be uncommented and a storage driver for postgresql or mysql or sqlite3 should be configured.

storage = "sql";
modules_enabled {
    storage = {
       archive2 = "sql";           


To allow xmpp conferences, enable chatroom component. To allow outsiders to see the conferences, make sure you add the appropriate DNS record. Make sure you update your ssl/tls certificates to include the new domain.

Component "" "muc"
    name = " chatrooms Server"
    modules_enabled = {
       storage = {                
           muc_log = "sql";

XMPP over TLS on HTTPS port

As of 2024 : documentation from "upstream" can be directly applied on Debian :

/!\ Note: Today, 2020, websocket might be the preferred approach. However, no (?) client support so far.

Now nginx can be used directly

So the section below is deprecated.

To allow connecting to XMPP service over HTTPS port (work around for firewalls that block all ports except 80 and 443),

verbose: false;
foreground: false;
inetd: false;
numeric: false;
transparent: false;
timeout: 2;
user: "nobody";
pidfile: "/var/run/sslh/";

# Change hostname with your external address name. Note: It should not be resolving to
    { host: ""; port: "443"; } 

   { name: "tls"; host: "localhost"; port: "5223"; alpn_protocols: [ "xmpp-client" ]; log_level: 0;},
   # catch anything else TLS
   { name: "tls"; host: "localhost"; port: "443";},
   { name: "xmpp";    host: "localhost"; port: "5222"; },
   { name: "timeout"; host: "localhost"; port: "443";}
on-timeout: "timeout";

# Try the following order, 5222/xmpp, 5223/tls, 443/xmpp, 443/tls 86400 IN SRV 5 1 5222 86400 IN SRV 10 1 5223 86400 IN SRV 15 1 443 86400 IN SRV 20 1 443

Check if you can connect to the xmpp port correctly.

openssl s_client -connect -alpn xmpp-client -servername

Note: importing the keys to Prosody could be needed for DirectTLS (for example if you use CertBot).

sudo prosodyctl --root cert import /etc/letsencrypt/live


invoke-rc.d prosody restart

And check the log files « /var/log/prosody/prosody.err » and « /var/log/prosody/prosody.log ».



The munin extension is available at munin contributed stuff git repository.

The use of this extension requires the console prosody module. So, remove the comment in front of console in the list of modules_enabled in the file « /etc/prosody/prosody.cfg.lua » .

DNS records

The XMPP protocol manages the records of type SRV, for example for the domain, you might want to make the following records: SRV  10 100 5222 SRV  10 100 5269            A

In this example is the IP of the public server.

Using Prosody with Diaspora