Friday, 27 July 2012

Setting Up Apache2 with SSL on Ubuntu

   #################Setting Up Apache2 with SSL on Ubuntu###############

#sudo apt-get install apache2 apache2.2-common apache2-utils openssl openssl-blacklist openssl-blacklist-extra ssl-cert

Enable mod_ssl

#sudo a2enmod ssl

Generate Your Private Key

#openssl genrsa -des3 -out server.key 1024
[enter a password]
[confirm your password]


Certificate Signing Request (CSR)

#openssl req -new -key server.key -out server.csr

[enter your private key password]
[enter your two character country code]
[enter your full state or province name]
[enter your city name]
[enter your company name]
[enter your organizational unit or leave it blank]
[enter your common name or fqdn]
[enter your admin email address]
[leave the rest of the attributes blank]


Sign Your Certificate Signing Request

#openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

create a new subdirectory in ssl

#mkdir  certs/
#mkdir  private/

Install the key and certificate:

#sudo cp server.crt /etc/apache2/ssl/certs/
#sudo cp server.key /etc/apache2/ssl/private/

Open the “defaults” file for editing:

#cd /etc/apache2/sites-available
#sudo vim default-ssl

This file is basically set up but you will want to uncomment  the SSLOptions line and also change the SSLCertificate lines to reflect the location and name of your new information.
SSLEngine on
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
SSLCertificateFile /etc/apache2/ssl/certs/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/private/server.key

The port 443 is enabled when you use SSL so that is ready to go.

Enable the default SSL site:
#sudo a2ensite default-ssl

#sudo service apache2 restart

To test open a browser and type in the following URL
https://localhost

No comments:

Post a Comment

Configure EKS Persistent Static Storage With Elastic File System Using Terraform

  checkout :https://youtu.be/QuUIgQWBBZM