deb/apache-letsencrypt.bash
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 02 May 2024 15:50:52 +0300
changeset 35 b524ac24e926
parent 34 68975e7d5237
child 36 dc0a281349d1
permissions -rw-r--r--
Avoid warning about existing dir.

#!/bin/bash

mkdir -p /srv/www/letsencrypt

# service apache2 stop
# --standalone

# Command requires Apache or Lighttpd running and aliasing (no need to stop Apache!):
#   Alias "/.well-known/acme-challenge/" "/srv/www/letsencrypt/.well-known/acme-challenge/"
certbot certonly --webroot \
 --agree-tos --non-interactive \
 -m gavenkoa@gmail.com \
 -w /srv/www/letsencrypt \
 --cert-name defun.work \
 -d defun.work \
 -d 2048.defun.work \
 -d blog.defun.work \
 -d cooking.defun.work \
 -d gadict.defun.work \
 -d hg.defun.work \
 -d resume.defun.work \
 -d stat.defun.work \
 -d test.defun.work \
 -d tips.defun.work

# service apache2 start

# https://wiki.debian.org/LetsEncrypt
# python3-certbot-apache - Apache plugin for Certbot

# systemctl reload apache2
# sudo certbot --apache --agree-tos --redirect -m youremail@email.com -d domainname.com -d www.domainname.com

cat >/srv/www/letsencrypt/apache-ssl-options.conf <<EOF
SSLEngine on
SSLProtocol             all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLOptions +StrictRequire

# Add vhost name to log entries:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common
EOF