I need help with installing SSL in my VPS. I am stuck in apache2 Magento configurations. I have changed all the options from Magento 2 backend and now the site is not working Kindly help with apache config and how can I redirect the site to https This is what I am using

< IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName spalding.co.in
        ServerAlias    www.spalding.co.in
        DocumentRoot /var/www/html/spalding
        <Directory /var/www/html/spaldng/>
        DirectoryIndex index.php index.html
        Options FollowSymLinks
        AllowOverride all
        Require all granted
         ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLCertificateFile /etc/apache2/ssl/5195fdcb4d95bdda.crt
SSLCertificateKeyFile /etc/apache2/ssl/spalding.key
SSLCertificateChainFile /etc/apache2/ssl/gd_bundle-g2-g1.crt

and I am confused about editing default-ssl.conf file do I need to edit this?


2 Answers 2


Please replace your certificate path with this.

SSLCertificateFile /etc/ssl/certs/5195fdcb4d95bdda.crt
SSLCertificateKeyFile /etc/ssl/private/spalding.key
SSLCertificateChainFile /etc/ssl/certs/gd_bundle-g2-g1.crt

And move the file to certs and private folder.

Restart apache and then check it.


This is what works for me in 000-default.conf file in apache2

<VirtualHost *:443> ServerAdmin [email protected] DocumentRoot /var/www/html/spalding ServerName spalding.co.in ServerAlias www.spalding.co.in SSLEngine on SSLCertificateFile /etc/apache2/ssl/f942dd2fd74f5884.crt SSLCertificateKeyFile /etc/apache2/ssl/spalding.co.in.key SSLCertificateChainFile /etc/apache2/ssl/gd_bundle-g2-g1.crt <Directory /var/www/html/spalding> Options FollowSymLinks AllowOverride All </Directory> </VirtualHost> <VirtualHost *:80> ServerName spalding.co.in ServerAlias www.spalding.co.in Redirect permanent / https://www.spalding.co.in </VirtualHost>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.