Question

Cannot install an SSL

Hi all,

I followed this guide to install a Comodo SSL to my VPS : https://www.digitalocean.com/community/tutorials/how-to-install-an-ssl-certificate-from-a-commercial-certificate-authority (Apache version)

First, I used Filezilla to upload the files I received from Comodo to /etc/ssl

Than I followed the instructions to modify 000-default.conf

This is the result:


<VirtualHost *443>
        ServerName www.mydomain.com
        Redirect permanent / https://www.mydomain.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        SSLEngine on
        SSLCertificateFile /etc/ssl/mydomain.crt
        SSLCertificateKeyFile /etc/ssl/mydomain.key
        SSLCACertificateFile /etc/ssl/mydomain.ca-bundle

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Would the problem be caused by the .ca-bundle?

Thanks!


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@julienr

As per the guide you’ve linked to, you should have two VirtualHost blocks – one serving requests on Port 80 and then one similar to the above that handles requests on Port 443 (i.e. SSL).

Your first VirtualHost block should look like the one shown below (of course, using your domain).

<VirtualHost *:80>
    ServerName mydomain.com
    Redirect permanent / https://mydomain.com
</VirtualHost>

Directly below the above, we set the VirtualHost block that handles the actual SSL connections.

<VirtualHost *:443>
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    SSLEngine on
    SSLCertificateFile /etc/ssl/mydomain.crt
    SSLCertificateKeyFile /etc/ssl/mydomain.key
    SSLCACertificateFile /etc/ssl/mydomain.ca-bundle

    <Directory /var/www/html/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

The difference between the above SSL definition and the one you provided in your original post is that the first line where you open the VirtualHost block, you need a colon between the asterisk and the port. The second issue which has been removed from the original is the line that redirects. You want to redirect from port 80 to port 443, not redirect port 443 to 443 :-).

You’ll want to replace mydomain.com with your actual domain, make sure the paths above are real paths, and then restart apache. That should help to get you up and running.

If you run in to any errors, you’ll want to take a look at the error log and see what’s showing as the error log often provides more details than what you’ll see in-browser.

Thanks, it worked!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.