1 |
# apt-get install ejabberd |
Opret en database til ejabberd:
1 |
mysql> CREATE DATABASE ejabberd; |
Indlæs databaselayout:
1 2 |
# cd /usr/lib/x86_64-linux-gnu/ejabberd-16.01/priv/sql/ # mysql -u root -p ejabberd < lite.sql |
(Note til mig i fremtiden: Fra version 16.03 ligger databaselayoutet i INSTALLDIR_OR_PREFIX/share/doc/ejabberd
)
Peg dit chatdomæne hen på den server hvor ejabberd er installeret og konfigurer:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
## ## SSL Virtual Host Context ## ### # chat.domain1.com ### <VirtualHost *:443> ServerName chat.domain1.com #Path to client app for chat users DocumentRoot /path/to/vhosts/prod.domain1.com #Alias for data directory (not ejabberd related) Alias /data /path/to/www/data/dk.domain1.com #Apache log files ErrorLog "|/usr/bin/rotatelogs -l /path/to/apache2-vhosts/chat3.domain1.com/error.%Y.%m.%d 86400" CustomLog "|/usr/bin/rotatelogs -l /path/to/apache2-vhosts/chat.domain1.com/access.%Y.%m.%d 86400" combined #Various php settings (not ejabberd related) php_value session.save_path /path/to/data/chat.domain1.com/sessions php_flag log_errors On php_flag display_errors Off php_value error_log /path/to/apache2-vhosts/chat.domain1.com/php_error.log #Proxy to point connections from port 80 to 8088 where ejabberd is running ProxyRequests Off ProxyPass /http-bind/ http://127.0.0.1:8088/http-bind/ ProxyPassReverse /http-bind/ http://127.0.0.1:8088/http-bind/ ProxyPass /admin/ http://127.0.0.1:8088/admin/ ProxyPassReverse /admin/ http://127.0.0.1:8088/admin/ AddDefaultCharset UTF-8 #SSL configuration SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCACertificateFile /path/to/local_certs/2018-domain1.com/intermediate.crt SSLCertificateFile /path/to/local_certs/2018-domain1.com/public.crt SSLCertificateKeyFile /path/to/local_certs/2018-domain1.com/private.key BrowserMatch ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 #Disable indexes for document root <Directory /path/to/vhosts/prod.domain1.com> Options -Indexes </Directory> </VirtualHost> |
Konfigurer ejabberd i /etc/ejabberd/ejabberd.yml … her er de værdier jeg har ændret:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
hosts: - "localhost" - "jabber.domain1.com" - "chat.domain1.com" - "test-chat.domain1.com" listen: - port: 8088 ip: "127.0.0.1" module: ejabberd_http web_admin: true http_bind: true http_poll: true auth_method: odbc auth_password_format: plain odbc_type: mysql odbc_server: "10.0.0.186" odbc_database: "ejabberd_prod" odbc_username: "ejabberd_prod" odbc_password: "secretpass" |
Nu kan vi registrere en bruger som skal bruges som administrator:
1 |
# ejabberdctl register admin chat.domain1.com secretpassword |
Hvis du, som jeg, har valgt at bruge ejabberd med en database, skulle du nu kunne se den nye bruger i tabellen ‘users’.
Nu skal vi fortælle systemet at ‘admin’ er administrator:
1 2 3 4 5 6 7 8 |
acl: admin: user: - "admin": "chat.domain1.com" access: configure: admin: allow |
… og genstarte ejabberd:
1 |
# ejabberdctl restart |
Tjek at du kan logge ind på webadmin (eks. https://chat.domain1.com/admin/) . Husk domænet i brugernavnet: admin@chat.domain1.com