Enabling SSL For Apache
Enabling SSL For Apache
Here we are creating the self-signed certificate, but the procedure would be the same even if you are going
to use a certificate from a Certification Authority like VeriSign, Trust Network.
1. Create certificates from Certification Authority or generate self-signed certificates from openSSL.
Creating a self-signed SSL Certificate using OpenSSL:
a. Open the command prompt and cd to your Apache installations "bin" directory. Usually it
would be:
It will ask you some questions and you can safely ignore them and just answer the following
questions:
PEM pass phrase: Password associated with the private key you’re generating (anything of
your choice).
Common Name: The fully-qualified domain name associated with this certificate (i.e.
www.your-domain.com).
Now we need to remove the passphrase from the private key. The file "server.key" created
from the following command should be only readable by the apache server and the
administrator.
Now we need to set up an expiry date, it could be any time of your choice, we use 365 days
below:
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
2. We have the Self-signed SSL certificates ready now. Now We need to MOVE the "server.crt" and
"server.key" file to the
"<<Apache_Home>>/SSL/conf" location.
3. Take a backup of httpd.conf file which is at “<<Apache_Home\conf" location.
Open the httpd.conf file in edit mode and look for the below lines and remove any pound sign (#)
characters preceding it.
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
4. Now we need to modify the "<<Apache_Home>>\conf\extra\httpd-ssl.conf". Let all the default
options as it is but make sure to modify the following section according to your need:
<VirtualHost _default_:443> Note: Remove _default_ and put * i.e <VirtualHost *:443>
ServerAdmin [email protected]
DocumentRoot "Your Root folder location” Like DocumentRoot "<<Apache_Home>>\htdocs"
ServerName www.domain.com:443
ServerAlias domain.com:443
ErrorLog "<<Apache_Home>>\logs\error.log"
TransferLog "<<Apache_Home>>\logs\access.log"
SSLEngine on
SSLCertificateFile "<<Apache_Home>>\conf/server.cert"
SSLCertificateKeyFile "<<Apache_Home>>\conf/server.key"
</VirtualHost>
5. Add the below lines at <VirtualHost *:443> section in "C:\Program Files\Apache Software
Foundation\Apache2.2\conf\extra\httpd-ssl.conf".
SSLProxyEngine on
ProxyPreserveHost On
ProxyPass /sample https://domain.com:8443/sample/
ProxyPassReverse /sample https://domain.com:8443/sample/
Note: Make sure that jboss has configured in SSL and application can be accessible through
https://domain.com:8443/sample/
6. Now restart the Apache & Jboss and try to access the RPM through HTTPS port.
i.e https://domain.com/