How can you redirect port 80 to 443 for SSL correctly?
7,236
I would recommend these tutorials, because for most situations they cover everything:
https://www.startssl.com/Support?v=21
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.
Related videos on Youtube
![Sol](https://i.stack.imgur.com/argga.jpg?s=256&g=1)
Author by
Sol
Updated on September 18, 2022Comments
-
Sol almost 2 years
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> <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 </VirtualHost>
-
Daniel B over 7 yearsPlease explain what exactly doesn’t work and how the problem manifests.
-
Sol over 7 yearsWhen 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.
-
Daniel B over 7 yearsSo Apache probably isn't running. Did you check its error log?
-
Sol over 7 yearsI 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 over 7 yearsLooking through this I did notice some errors in my configuration from the start! :)