In cryptography and computer security, a self-signed certificate is an identity certificate that is signed by the same entity whose identity it certifies. This term has nothing to do with the identity of the person or organization that actually performed the signing procedure. In technical terms a self-signed certificate is one signed with its own private key.
Self-signed ssl certificates can be used to set up temporary ssl servers. You can use it for test and development servers where security is not a big concern. Use the form below to generate a self-signed ssl certificate and key.
Environment on which this post was done: Ubuntu 12.04 and Apache 2.2 (it might work on other distro/version but need to be adapted)
Generating the certificate
This commend will output two files, domain_com.key and domain_com.crt:
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout domain_com.key -out domain_com.crt
Move the files into ssl folder and protecting its accessibility by changing the owner/group and permission:
$ sudo chown root:root domain_com.key domain_com.crt ; sudo chmod 700 domain_com.key domain_com.crt
$ sudo mkdir /etc/apache2/ssl ; sudo mv domain_com.* /etc/apache2/ssl/
Adding the following lines in the Virtualhost
Enabling mode ssl and restarting Apache2
$ sudo a2enmod ssl && sudo /etc/init.d/apache2 restart
Did you like this post? give us your feedback!