Configuring a new SSL/TLS domain on Apache2
The very easy way.
With Let's Encrypt certificates
How to set up SSL/TLS on Apache for securing web communication. Let’s Encrypt certificate generation.
What do we want:
We want to be able to reach example.com under HTTPS protocol on TLS from scratch.
Apache2 vhost
In /etc/apache2/sites-available/ copy the default one into example.com.conf
Now open example.com.conf and add "ServerName example.com" under "DocumentRoot ... "
Make sure ssl is enabled in Apache with:
Now restart apache2:
You can go to http://example.com to check if it’s working. You should see the standart Apache2 Ubuntu Default Page.
Let's Encrypt CertBot
Go to https://certbot.eff.org/ end select your configuration.
For Ubuntu the commands needed are:
Certificate Generation (RSA 4096bit)
If you want a simple RSA certificate without further security options go straight with:
If you want also OCSP Stapling then go with this command:
The –redirect will automatically configure apache to redirect users from HTTP to HTTPS. At the end, certbot has created and acrivated a new virtual host for the https domain called example.com-le-sll.conf
Restart apache2 the last time.
DONE!
Now you can go to http://example.com and apache will redirect you to the https version.
Please feel free to make any comment! If anything is unclear, just write in the comment and I will update the post!Thanks for reading!