Dodawanie nowej domeny – katalog, konfiguracja Apache2, certbot
# mkdir -p /var/www/cse.h27.pl
# chown -R $USER:$USER /var/www/cse.h27.pl
# nano /var/www/cse.h27.pl/index.html
<html> <head> <title>Nowa domena!</title> </head> <body> <h1>Nowa domena abc.pl</h1> </body> </html>
# nano /etc/apache2/sites-available/cse.h27.pl.conf
<VirtualHost *:80> ServerAdmin admin@h27.pl ServerName cse.h27.pl #ServerAlias www.cse.h27.pl DocumentRoot /var/www/cse.h27.pl ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
# /usr/sbin/a2ensite cse.h27.pl.conf // włączenie nowej domeny
# /usr/sbin/a2dissite 000-default.conf // TYLKO RAZ - wyłączenie domyślnej konfig.
# /usr/sbin/apache2ctl configtest // test konfiguracji
-- Ustawienie nazwy serwera APACHE2 -- # nano /etc/apache2/apache2.conf ServerName cse.h27.pl
# /usr/sbin/apache2ctl graceful // lub # systemctl reload apache2
# tail -f /var/log/apache2/error.log # tail -f /var/log/apache2/access.log
# certbot --apache
Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/cse.h27.pl/fullchain.pem Key is saved at: /etc/letsencrypt/live/cse.h27.pl/privkey.pem // Automatyczne odnowienie Certbot has set up a scheduled task to automatically renew this certificate in the background. // Ustawia konfigurację Apache2 SSL Deploying certificate Successfully deployed certificate for cse.h27.pl to /etc/apache2/sites-available/cse.h27.pl-le-ssl.conf
# cat /etc/apache2/sites-available/cse.h27.pl-le-ssl.conf
<IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin admin@h27.pl ServerName cse.h27.pl DocumentRoot /var/www/cse.h27.pl ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLCertificateFile /etc/letsencrypt/live/cse.h27.pl/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/cse.h27.pl/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule>
# systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES ... Mon 2022-02-07 21:37:00 CET 5h 4min left n/a n/a snap.certbot.renew.timer snap.certbot.renew.service ...