sudo apt-get update
sudo apt-get install apache2
cd /etc/apache2/sites-available/
sudo cp 000-default.conf 001-example.com.conf
sudo nano 001-example.com.conf
<VirtualHost *:80>
ServerAdmin you@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
<Directory /var/www/example.com/public_html>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# https force redirect
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
sudo a2ensite 001-example.com.conf
sudo service apache2 reload
sudo apachectl restart
sudo a2dissite 001-example.com.conf
sudo service apache2 reload
sudo apachectl restart
sudo apachectl configtest
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.4
sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y
sudo a2dismod php5
sudo a2enmod php7.4
sudo apachectl restart
which php
php -v
php --ini
php -i
php -m
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-apache
sudo apt-get remove certbot
sudo snap install --classic certbot
If you don't have snap pre-installed, read more here: Snap
sudo certbot --apache
sudo certbot renew --dry-run
sudo certbot --apache -d example.com -d www.example.com