Install https on Ubuntu

 

# Firewall port 80 and 443 need to be open !!!
Be aware that there is a DNS  record for the server available

hostname

sudo vim /etc/hostname

sudo vim /etc/hosts

sudo systemctl reboot

mkdir /var/www/html/domain.com/

chown -R www-data:www-data /var/www/html/domain.com

vim /etc/apache2/sites-available/domain.conf.conf

<VirtualHost *:80>
     ServerAdmin webmaster@domain.com
     ServerName domain.com
     ServerAlias domain.com
     DocumentRoot /var/www/html/domain.com/
     ErrorLog /var/www/html/domain.com/logs/error.log
     CustomLog /var/www/html/domain.com/logs/access.log combined
</VirtualHost>

a2dissite 000-default.conf

a2ensite domain.com.conf

systemctl reload apache2

apt-get -y install certbot python3-certbot-apache

certbot --apache