Install your Certificates on Apache (OpenSSL)

How to determine if OpenSSL and mod_ssl are installed on apache2

Usually, when you compile your apache2 server (or install it by packages facility stuff), you can check any directive that're available to be used by tapping this command:
~# $(which httpd) -L | grep SSL # on RHEL/CentOS/Fedora
~# $(which apache2) -L | grep SSL # on Ubuntu/Debian
If you don't see any SSL* directive, it means that you don't have apache2 with mod_ssl compiled.
For RHEL/CentOS/Fedora:
$ httpd -t -D DUMP_MODULES | grep ssl
ssl_module (shared)
For Ubuntu/Debian
$ apache2 -t -D DUMP_MODULES | grep ssl
ssl_module (shared)


----------------
Apache SSL Installation Instructions
Save the primary and intermediate certificates to a folder on the server with the private key.
Open the Apache configuration file in a text editor. Apache configuration files are usually found in /etc/httpd. The main configuration file is usually named httpd.conf. In most cases the <VirtualHost> blocks will be at the bottom of this httpd.conf file. Sometimes you will find the <VirtualHost> blocks in a separate file in a directory like /etc/httpd/vhosts.d/ or /etc/httpd/sites/ or in a file called ssl.conf.
If you need your site to be accessible through both secure (https) and non-secure (http) connections, you will need a virtual host for each type of connection. Make a copy of the existing non-secure virtual host and change the port from port 80 to 443.
Add the lines in bold below.

<VirtualHost 192.168.0.1:443>
DocumentRoot /var/www/website
ServerName www.domain.com
SSLEngine on
SSLCertificateFile /etc/ssl/crt/primary.crt
SSLCertificateKeyFile /etc/ssl/crt/private.key
SSLCertificateChainFile /etc/ssl/crt/intermediate.crt
</VirtualHost> 

Change the names of the files and paths to match your certificate files:
SSLCertificateFile should be your primary certificate file for your domain name.
SSLCertificateKeyFile should be the key file generated when you created the CSR.
SSLCertificateChainFile should be the intermediate certificate file (if any) that was supplied by your certificate authority
Save the changes and exit the text editor.
Restart your Apache web server using one of the following commands:
/usr/local/apache/bin/apachectl startssl

/usr/local/apache/bin/apachectl restart



For Apache v1.X
  1. Download the appropriate Intermediate Certificate(s) and save it in a text editor as intermediate.pem:
  2. Copy your SSL Certificate out of the order fulfilment e-mail (or log into your GlobalSign Certificate Center account and download it) and paste it into a text editor and save as mydomain.pem.
  3. Copy “mydomain.crt” and “intermediate.pem” to the directory in which you plan to store your certificates.
  4. Open your httpd.conf file (some installations keep the SSL section separately in the ssl.conf file) using a text editor, and locate the virtual host section for the site for which the SSL Certificate will secure.
  5. Your virtual host section will need to contain the following directives:
    • SSLCertificateChainFile – This will need to point to the appropriate Intermediate root CA certificates.
    • SSLCertificateFile – This will need to point to the end entity certificate (the one you have called “mydomain.crt”)
    • SSLCertificateKeyFile – This will need to point to the private key file associated with your certificate.
  6. Save the changes to the file and quit the text editor
  7. Restart apache.
For Apache 2.X
  1. Download the appropriate GlobalSign root certificate and save it in a text editor as gs_root.pem:
  2. Download the appropriate Intermediate Certificate(s) and save it in a text editor as intermediate.pem:
  3. Copy your SSL Certificate out of the order fulfilment e-mail (or log into your GlobalSign Certificate Center account and download it) and paste it into a text editor and save as mydomain.crt.
  4. Copy “mydomain.crt” and “intermediate.pem” to the directory in which you plan to store your certificates.
  5. Open your httpd.conf file (some installations keep the SSL section separately in the ssl.conf file) using a text editor and locate the the virtual host section for the site for which the SSL Certificate will secure.
    • Your virtual host section will need to contain the following directives:
    • SSLCACertificateFile – This will need to point to the appropriate GlobalSign root CA certificate.
    • SSLCertificateChainFile – This will need to point to the appropriate intermediate root CA certificates you previously created in Step 1 above.
    • SSLCertificateFile – This will need to point to the end entity certificate (the one you have called "mydomain.crt")
    • SSLCertificateKeyFile – This will need to point to the private key file associated with your certificate.
  6. Save the changes to the file and quit the text editor
  7. Restart apache.

-----------

Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all