You need to ensure you've installed & configured your ssl cert before enabling the https login setting for moodle.
If you lock yourself out, add the following line to your config.php
$CFG -> loginhttps=false;
or
running the following query on your mysql database
UPDATE mdl_config SET value = 0 WHERE name = 'loginhttps'