How to create a self-signed X.509 SSL certificate with OpenSSL in one command line
June 18, 2014 Comments
I must have ran this command a hundred times by now but could never remember it:
sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout example.key -out example.crt
This will create a self-signed SSL certificate with an expiration of 10 years using a 2048-bit key. You can use this certificate with Apache2, Nginx, etc.