create self signed certificate for website and use in linux

Within in 5 minutes you can can create self signed certificate on linux machine. First you need to open console and execute following command. Before executing following command first check openssl utility is installed on your linux machine.

# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mysitename.key -out mysitename.crt

Then open your apache configuration file and put following code in that file.

NameVirtualHost *:443

  DocumentRoot /home/purab/public_html/

  <Directory "/home/purab/public_html/">
    Order Deny,Allow
    Allow from all
    AllowOverride All

  ErrorLog logs/
  CustomLog logs/ combined
  RewriteLog logs/

  SSLEngine on
  SSLCertificateFile /home/purab/projects/
  SSLCertificateKeyFile /home/purab/projects/
  SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
  CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

For gettting pem certificate from ssl cert.
openssl x509 -in mysitename.crt -out mysitename.pem -outform PEM

Add a Comment

Your email address will not be published. Required fields are marked *