sudo mkdir -p /var/www/site
sudo chown -R $USER:$USER /var/www/site
sudo chmod -R 755 /var/www/site
sudo nano /etc/apache2/sites-available/site.conf
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/site
<Directory /var/www/site>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/site_error.log
CustomLog ${APACHE_LOG_DIR}/site_access.log combined
</VirtualHost>
sudo a2ensite site.conf
sudo apache2ctl configtest
sudo a2enmod ssl
sudo a2enmod headers
sudo systemctl restart apache2
sudo apt update
sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache -d example.com -d www.example.com
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo systemctl reload apache2
sudo tail -f /var/log/apache2/site_error.log
sudo tail -f /var/log/apache2/site_access.log