Yum Install mod_ssl openssl
# Generate private key
openssl genrsa -out ca.key 1024
# Generate CSR
openssl req -new -key ca.key -out your_name.csr
# Generate Self Signed Key
openssl x509 -req -days 365 -in your_name.csr -signkey your_name.key -out your_name.crt
# Copy the files to the correct locations
cp ca.crt /etc/pki/tls/certs/your_name.crt
cp ca.key /etc/pki/tls/private/your_name.key
cp ca.csr /etc/pki/tls/private/your_name.csr
vi /etc/httpd/conf.d/ssl.conf
change path for
SSLCertificateKeyFile and SSLCertificateFile
service httpd restart
vi /etc/httpd/conf/httpd.conf
add this line at the last
Include conf/vhosts/*.conf
mkdir /etc/httpd/conf/ssl-vhosts
mkdir /etc/httpd/conf/vhosts
vi /etc/httpd/conf/ssl-vhosts/vhosts-ssl.conf
vi /etc/httpd/conf/vhosts/vhosts.conf add this line in this page
To Redirect do as follows
<VirtualHost *:80>
ServerName mysite.example.com
DocumentRoot /usr/local/apache2/htdocs
Redirect permanent / https://mysite.example.com
</VirtualHost>
<VirtualHost _default_:443>
ServerName mysite.example.com
DocumentRoot /var/www/your_dir
SSLEngine On
</VirtualHost>