First, you need to add a wildcard, A record. Like *.your-domain.com
Install the Ejabberd using the below command
sudo su
apt update
apt upgrade
apt install ejabberd-contrib ejabberd
We need to stop the Ejabberd service to configure the Ejabberd using the below command
systemctl stop ejabberd
Enable UFW port using the below command
ufw allow ssh
ufw allow 80
ufw allow 5443
ufw allow 5222
ufw allow 5223
ufw allow 5269
ufw allow 4369
ufw allow 5280
ufw enable
If your computer already installed Nginx, then you need to redirect 80 ports to 5280 for SSL verification
Please change your Nginx site-available config file like the one below
server {
listen 80;
listen [::]:80;
server_name your-domain.com *.your-domain.com;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass "http://127.0.0.1:5280";
}
}
Save the file and restart Nginx using the below command
nginx -t && nginx -s reload
Then edit the `
Then edit the /etc/ejabberd/ejabberd.yml
file using the below command
nano /etc/ejabberd/ejabberd.yml
Change host from localhost to your host like the below. Add "
before and after domain like the below
hosts:
- "your-domain.com"
Remove admin access from 5280 port by commenting below a line
port: 5280
ip: "::"
module: ejabberd_http
#tls: true
#protocol_options: 'TLS_OPTIONS'
request_handlers:
#/admin: ejabberd_web_admin
/.well-known/acme-challenge: ejabberd_acme
Add admin access to 5443 port using the below changes
port: 5443
ip: "::"
module: ejabberd_http
tls: true
protocol_options: 'TLS_OPTIONS'
request_handlers:
/admin: ejabberd_web_admin
/api: mod_http_api
/bosh: mod_bosh
## /captcha: ejabberd_captcha
## /upload: mod_http_upload
/ws: ejabberd_http_ws
Enable an admin account using the below changes
acl:
admin:
user:
- "admin"
Save the file by pressing Ctrl + o
then press Enter key then press Ctrl + x
After that, install SSL certification and restart the server using the below command
apt install certbot python3-certbot-nginx
systemctl start ejabberd
ejabberdctl request_certificate all
Register admin account by using the below command
sudo ejabberdctl register <USER> <DOMAIN> <PASS>
Change <USER>
<DOMAIN>
<PASS>
with your user domain password like below
sudo ejabberdctl register admin your-domain.com password
Access the below URL using your browser and login it
https://your-domain.com:5443/admin
If you use MySQL, you need to install the below packages
apt install erlang-p1-mysql