Apache setup for https
With a Self-Signing Key:
- # sudo apt-get install apache2 openssl
- # a2enmod ssl
- # a2enmod rewrite
- # mkdir /etc/apache2/certificate
- # cd /etc/apache2/certificate
- # openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out apache-certificate.crt -keyout apache.key
- /etc/apache2/sites-enabled/000-default.conf
- service apache2 restart
Optional: (and skipped)
- # vi /etc/apache2/apache2.conf
- add the followings at the end of the file:
<Directory /var/www/html>
AllowOverride All
</Directory>
With a key from certbot(Let's Encrypt auto key update)
Let's Encrypt issues certificates through an automated API based on the ACME protocol.
An ACME client is required and certbot client is recommended for such a program.
It is very simple to install.
Reference: https://letsencrypt.org/getting-started/
$ sudo snap install --classic certbot
$ sudo ln -s /snap/bin/certbot /usr/bin/
$ sudo certbot --apache # select 000-defaults.conf with https
$ sudo certbot renew --dry-run
With a key from ZeroSSL
- Download and unzip doc.uk.to.zip
- /etc/ssl/ca_bundle.crt
- /etc/ssl/certificate.crt
- /etc/ssl/private.key
- /etc/apache2/sites-enabled/000-default.conf
- service apache2 restart
Go back to Computer
20230924