简体   繁体   中英

Unable to connect (trying to set up SSL in ubuntu)

I purchased an SSL certificate and had it validated. The vendor then sent me the files.

This is my first time adding an SSL to ubuntu.

In my sites enabled folder in Apache I added a new conf file example-ssl.conf

I then added the following

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerAdmin info@example.ie
        ServerName example.ie
        ServerAlias www.example.ie

        DocumentRoot /var/www/html/example/

        #LogLevel info ssl:warn

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


        SSLEngine on


        SSLCertificateFile  /etc/ssl/certs/example.crt
        SSLCertificateKeyFile /etc/ssl/private/example_private.key

        <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>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

I then ran sudo a2ensite example-ssl.conf

But got an error...

Site example-ssl not properly enabled: /etc/apache2/sites-enabled/example-ssl.conf is a real file, not touching it

So I decided to change default-ssl.conf with the same information as above,

I then ran sudo a2ensite default-ssl.conf which worked.

I restarted apache,

but when I go to https://www.example.com , I get an unable to connect error as if the site doesnt exist at all. "Firefox can't establish a connection to the server at www.example.ie."

Thank you

EDIT: A bit of background, I set this up using Digital Ocean. I've now realised this is happening with all my droplets when I try to use https. So perhaps its a more generic setting on linux I need to enable

You don't show any "Listen 443" directive. That's step one if you expect Apache to listen for connections on a new port.

Also everything you posted is a no-op if mod_ssl isn't loaded due to your ifModule.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM