Option A: Keep Apache on 50005 and Manually Add HTTPS Make sure ports 80 and 443 are temporarily open (ask your network team if needed): sudo ufw allow 80 sudo ufw allow 443 Run Let’s Encrypt to issue the certificate: Even if Apache listens on port 50005, you can still run Certbot using the --standalone method: sudo systemctl stop apache2 sudo certbot certonly --standalone -d elearning.uegcl.go.ug sudo systemctl start apache2 Update your Apache VirtualHost for HTTPS on port 50005: ServerName elearning.uegcl.go.ug DocumentRoot /var/www/html/moodle SSLEngine on SSLCertificateFile /etc/letsencrypt/live/elearning.uegcl.go.ug/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/elearning.uegcl.go.ug/privkey.pem Options Indexes FollowSymLinks AllowOverride All Require all granted Allow port 50005 over HTTPS: sudo ufw allow 50005/tcp sudo systemctl restart apache2 Update Moodle config.php: $CFG->wwwroot = 'https://elearning.uegcl.go.ug:50005';