ssl configuration in apache
ssl configuration
STEP1:Generate the CSR & PRIVATE KEY using following command,
Goto terminal using following command,
> ssh root@ipaddress
> Enter password
> openssl req -newkey rsa:2048 -nodes -keyout example.com.key -out example.com.csr
Replace the example.com with your domain.
Enter following value,
Country Name (2 letter code) [AU]: AU
State or Province Name (full name) [Some-State]: State Name
Locality Name (eg, city) []: City
Organization Name (eg, company) [Internet Widgits Pty Ltd]: company name Pvt. Ltd
Organizational Unit Name (eg, section) []: section like shopping, travel etc.,
Common Name (eg, YOUR name) []: *.example.com (For Wildcard SSL). For Single example.com
Email Address []: give your email ID
example.com.key & example.com.csr generated in the root directory.
STEP 2:
1. GET ssl-certificate.crt & intermediate.crt or ca-bundle.crt from the SSL Service providerUpload the following files in the desired location on the server
Location: /etc/ssl/
1. ssl-certificate.crt
2. example.com.key
3. intermediate.crt or ca-bundle.crt
STEP 3:
Make sure ssl-certificate.crt & example.com.key is matchingOption 1:
Goto terminal and enter following command,
> openssl x509 -in /etc/ssl/example.com.crt -noout -modulus | openssl sha1
> openssl rsa -in /etc/ssl/example.com.key -noout -modulus | openssl sha1
Option 2 - Using online: https://www.sslshopper.com/certificate-key-matcher.html
STEP 4:
STEP 4: configure the virtual host Location of the files /etc/apache2/sites-available 1. example.com.conf 2. example.com-ssl.conf example.com.conf as follows,<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Redirect permanent "/" "https://example.com/"
<VirtualHost/>
example.com-ssl.conf as follows,
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/ssl-certificate.crt
SSLCertificateKeyFile /etc/ssl/example.com.key
SSLCertificateChainFile /etc/ssl/intermediate.crt or ca-bundle.crt
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
Get government job alert. Don't miss the opportunity!! CLICK HERE
STEP 5:
enable the configuration using terminal > sudo a2enmod ssl > sudo a2ensite example.com.conf > sudo a2nsite example.com-ssl.conf > sudo service apache2 restart
{/}
Code


No comments:
Post a Comment