Integrated Lets Encrypt into all sites.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 07 May 2023 13:04:33 +0300
changeset 21 52f40bd9e114
parent 20 f1b38aa4fa52
child 22 5d4380dda5ad
Integrated Lets Encrypt into all sites.
deb/apache-register-2048.bash
deb/apache-register-blog.bash
deb/apache-register-cooking.bash
deb/apache-register-gadict.bash
deb/apache-register-hg.bash
deb/apache-register-resume.bash
deb/apache-register-stat.bash
deb/apache-register-test.bash
deb/apache-register-tips.bash
deb/apache-register-welcome.bash
--- a/deb/apache-register-2048.bash	Sun May 07 12:48:30 2023 +0300
+++ b/deb/apache-register-2048.bash	Sun May 07 13:04:33 2023 +0300
@@ -20,7 +20,7 @@
 </VirtualHost>
 
 <IfModule mod_ssl.c>
-  <VirtualHost 2048.defun.work:443>
+  <VirtualHost $d.defun.work:443>
 	DocumentRoot /srv/www/$d
     ServerName $d.defun.work
 
--- a/deb/apache-register-blog.bash	Sun May 07 12:48:30 2023 +0300
+++ b/deb/apache-register-blog.bash	Sun May 07 13:04:33 2023 +0300
@@ -11,13 +11,29 @@
 
 cat <<EOF >/etc/apache2/sites-available/$d.conf
 <VirtualHost $d.defun.work:*>
-	DocumentRoot /srv/www/$d
+    DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
 
     <Directory "/srv/www/$d/">
         Require all granted
     </Directory>
 </VirtualHost>
+
+<IfModule mod_ssl.c>
+  <VirtualHost $d.defun.work:443>
+	DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
+
+    <Directory "/srv/www/$d/">
+        Require all granted
+    </Directory>
+
+    SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem
+    SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem
+    Include /etc/letsencrypt/options-ssl-apache.conf
+  </VirtualHost>
+</IfModule>
 EOF
 
 a2ensite $d
-service apache2 restart
+service apache2 reload
--- a/deb/apache-register-cooking.bash	Sun May 07 12:48:30 2023 +0300
+++ b/deb/apache-register-cooking.bash	Sun May 07 13:04:33 2023 +0300
@@ -11,13 +11,29 @@
 
 cat <<EOF >/etc/apache2/sites-available/$d.conf
 <VirtualHost $d.defun.work:*>
-	DocumentRoot /srv/www/$d
+    DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
 
     <Directory "/srv/www/$d/">
         Require all granted
     </Directory>
 </VirtualHost>
+
+<IfModule mod_ssl.c>
+  <VirtualHost $d.defun.work:443>
+	DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
+
+    <Directory "/srv/www/$d/">
+        Require all granted
+    </Directory>
+
+    SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem
+    SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem
+    Include /etc/letsencrypt/options-ssl-apache.conf
+  </VirtualHost>
+</IfModule>
 EOF
 
 a2ensite $d
-service apache2 restart
+service apache2 reload
--- a/deb/apache-register-gadict.bash	Sun May 07 12:48:30 2023 +0300
+++ b/deb/apache-register-gadict.bash	Sun May 07 13:04:33 2023 +0300
@@ -11,13 +11,29 @@
 
 cat <<EOF >/etc/apache2/sites-available/$d.conf
 <VirtualHost $d.defun.work:*>
-	DocumentRoot /srv/www/$d
+    DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
 
     <Directory "/srv/www/$d/">
         Require all granted
     </Directory>
 </VirtualHost>
+
+<IfModule mod_ssl.c>
+  <VirtualHost $d.defun.work:443>
+	DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
+
+    <Directory "/srv/www/$d/">
+        Require all granted
+    </Directory>
+
+    SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem
+    SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem
+    Include /etc/letsencrypt/options-ssl-apache.conf
+  </VirtualHost>
+</IfModule>
 EOF
 
 a2ensite $d
-service apache2 restart
+service apache2 reload
--- a/deb/apache-register-hg.bash	Sun May 07 12:48:30 2023 +0300
+++ b/deb/apache-register-hg.bash	Sun May 07 13:04:33 2023 +0300
@@ -40,6 +40,7 @@
 cat <<EOF >/etc/apache2/sites-available/hg.conf
 <VirtualHost hg.defun.work:*>
     DocumentRoot /srv/hg
+    ServerName hg.defun.work
 
     ScriptAliasMatch  ^/(.*)  /srv/hg/hgweb.cgi/\$1
 
@@ -50,8 +51,23 @@
         AddHandler cgi-script .cgi
     </Directory>
 </VirtualHost>
+
+<IfModule mod_ssl.c>
+  <VirtualHost hg.defun.work:443>
+    DocumentRoot /srv/hg
+    ServerName hg.defun.work
+
+    ScriptAliasMatch  ^/(.*)  /srv/hg/hgweb.cgi/\$1
+
+    <Directory "/srv/hg/">
+        Options +ExecCGI
+        Require all granted
+        AllowOverride None
+        AddHandler cgi-script .cgi
+    </Directory>
+  </VirtualHost>
+</IfModule>
 EOF
 
 a2ensite hg
-systemctl reload apache2
-
+service apache2 reload
--- a/deb/apache-register-resume.bash	Sun May 07 12:48:30 2023 +0300
+++ b/deb/apache-register-resume.bash	Sun May 07 13:04:33 2023 +0300
@@ -11,13 +11,29 @@
 
 cat <<EOF >/etc/apache2/sites-available/$d.conf
 <VirtualHost $d.defun.work:*>
-	DocumentRoot /srv/www/$d
+    DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
 
     <Directory "/srv/www/$d/">
         Require all granted
     </Directory>
 </VirtualHost>
+
+<IfModule mod_ssl.c>
+  <VirtualHost $d.defun.work:443>
+	DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
+
+    <Directory "/srv/www/$d/">
+        Require all granted
+    </Directory>
+
+    SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem
+    SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem
+    Include /etc/letsencrypt/options-ssl-apache.conf
+  </VirtualHost>
+</IfModule>
 EOF
 
 a2ensite $d
-service apache2 restart
+service apache2 reload
--- a/deb/apache-register-stat.bash	Sun May 07 12:48:30 2023 +0300
+++ b/deb/apache-register-stat.bash	Sun May 07 13:04:33 2023 +0300
@@ -11,13 +11,29 @@
 
 cat <<EOF >/etc/apache2/sites-available/$d.conf
 <VirtualHost $d.defun.work:*>
-	DocumentRoot /srv/www/$d
+    DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
 
     <Directory "/srv/www/$d/">
         Require all granted
     </Directory>
 </VirtualHost>
+
+<IfModule mod_ssl.c>
+  <VirtualHost $d.defun.work:443>
+	DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
+
+    <Directory "/srv/www/$d/">
+        Require all granted
+    </Directory>
+
+    SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem
+    SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem
+    Include /etc/letsencrypt/options-ssl-apache.conf
+  </VirtualHost>
+</IfModule>
 EOF
 
 a2ensite $d
-service apache2 restart
+service apache2 reload
--- a/deb/apache-register-test.bash	Sun May 07 12:48:30 2023 +0300
+++ b/deb/apache-register-test.bash	Sun May 07 13:04:33 2023 +0300
@@ -11,13 +11,29 @@
 
 cat <<EOF >/etc/apache2/sites-available/$d.conf
 <VirtualHost $d.defun.work:*>
-	DocumentRoot /srv/www/$d
+    DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
 
     <Directory "/srv/www/$d/">
         Require all granted
     </Directory>
 </VirtualHost>
+
+<IfModule mod_ssl.c>
+  <VirtualHost $d.defun.work:443>
+	DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
+
+    <Directory "/srv/www/$d/">
+        Require all granted
+    </Directory>
+
+    SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem
+    SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem
+    Include /etc/letsencrypt/options-ssl-apache.conf
+  </VirtualHost>
+</IfModule>
 EOF
 
 a2ensite $d
-service apache2 restart
+service apache2 reload
--- a/deb/apache-register-tips.bash	Sun May 07 12:48:30 2023 +0300
+++ b/deb/apache-register-tips.bash	Sun May 07 13:04:33 2023 +0300
@@ -11,13 +11,29 @@
 
 cat <<EOF >/etc/apache2/sites-available/$d.conf
 <VirtualHost $d.defun.work:*>
-	DocumentRoot /srv/www/$d
+    DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
 
     <Directory "/srv/www/$d/">
         Require all granted
     </Directory>
 </VirtualHost>
+
+<IfModule mod_ssl.c>
+  <VirtualHost $d.defun.work:443>
+	DocumentRoot /srv/www/$d
+    ServerName $d.defun.work
+
+    <Directory "/srv/www/$d/">
+        Require all granted
+    </Directory>
+
+    SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem
+    SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem
+    Include /etc/letsencrypt/options-ssl-apache.conf
+  </VirtualHost>
+</IfModule>
 EOF
 
 a2ensite $d
-service apache2 restart
+service apache2 reload
--- a/deb/apache-register-welcome.bash	Sun May 07 12:48:30 2023 +0300
+++ b/deb/apache-register-welcome.bash	Sun May 07 13:04:33 2023 +0300
@@ -12,12 +12,28 @@
 cat <<EOF >/etc/apache2/sites-available/$d.conf
 <VirtualHost defun.work:*>
 	DocumentRoot /srv/www/$d
+    ServerName defun.work
 
     <Directory "/srv/www/$d/">
         Require all granted
     </Directory>
 </VirtualHost>
+
+<IfModule mod_ssl.c>
+  <VirtualHost defun.work:443>
+	DocumentRoot /srv/www/$d
+    ServerName defun.work
+
+    <Directory "/srv/www/$d/">
+        Require all granted
+    </Directory>
+
+    SSLCertificateFile /etc/letsencrypt/live/defun.work/fullchain.pem
+    SSLCertificateKeyFile /etc/letsencrypt/live/defun.work/privkey.pem
+    Include /etc/letsencrypt/options-ssl-apache.conf
+  </VirtualHost>
+</IfModule>
 EOF
 
 a2ensite $d
-service apache2 restart
+service apache2 reload