Create a SSL key (read  this tutorial for more information):

openssl req -new -x509 -newkey rsa:1024 -days 3650 -keyout privkey.pem -out server.pem
openssl rsa -in privkey.pem -out privkey.pem
cat privkey.pem >> server.pem
rm privkey.pem

Now edit your ejabberd.cfg file and specify the correct location of your server.pem:

{listen, [{5222, ejabberd_c2s,     [{access, c2s}, {shaper, c2s_shaper},
                                    starttls, {certfile, "/home/ejabberd/server.pem"}]},
          {5223, ejabberd_c2s,     [{access, c2s}, {shaper, c2s_shaper},
                                    ssl, {certfile, "/home/ejabberd/server.pem"}]},
