I got a public certficate for ssl from startssl.com. It worked, then I have to redo my system to get phpmyadmin to work. Everything works on port 80 before I change the default configuration to this below.

I originally got the ssl to work, and my certificate asks for the password which works. Then I tried to redirect the website from 80 to 443 but never quite got it and am not sure what I am missing or doing wrong:

sudo apt-get update
sudo apt-get install lamp-server^
sudo a2enmod ssl

after nano below:
sudo service apache2 restart

nano /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
Redirect / https://www.example.com/

#DocumentRoot /var/www/html
#Redirect permanent /secure https://www.example.com

<VirtualHost _default_:443>
#<VirtualHost *:443>

    ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ServerName www.example.com
        ServerAlias example.com
SSLEngine on
SSLCertificateFile /etc/ssl/test/1_root_bundle.crt
SSLCertificateKeyFile /etc/ssl/test/newestkey.key
SSLCACertificateFile /etc/ssl/test/2_example.com.crt
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

  • 1
    Please explain what exactly doesn’t work and how the problem manifests. – Daniel B Nov 27 '16 at 18:12
  • When I do this is just won't load the webpage at all. There aren't any apache errors. The web browser just says that there is an error connecting. This is for the port 80 and 443 side of things. So nothing can be connected and it all relates to this file. – Sol Nov 27 '16 at 18:46
  • 1
    So Apache probably isn't running. Did you check its error log? – Daniel B Nov 27 '16 at 21:42
  • I think you are right. It seemed like it would go, but my virtual machine I believe actually got corrupted. So I created a new ubuntu image and will try over again to see if it has the same results as this! – Sol Nov 28 '16 at 4:07

I would recommend these tutorials, because for most situations they cover everything:



First link will get you to make self signed certificate to test your SSL.
The second link will be for a free public ssl for testing.

  • Looking through this I did notice some errors in my configuration from the start! :) – Sol Nov 30 '16 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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