Generate a Self-Signed SSL Certificate on CentOS

  1. su root
  2. openssl genrsa -des3 -passout pass:x -out key.key 2048
  3. openssl rsa -passin pass:x -in key.key -out keypair.key
  4. rm -rf key.key
  5. openssl req -new -key keypair.key -out keypair.csr
  6. openssl x509 -req -days 3650 -in keypair.csr -signkey keypair.key -out keypair.crt
  7. mv keypair.key keypair.crt /etc/pki/tls/certs/
  8. vim /etc/httpd/conf/httpd.conf
  9. add

    SSLCertificateFile /etc/pki/tls/certs/keypair.crt

    SSLCertificateKeyFile /etc/pki/tls/certs/keypair.key

  10. service httpd restart