I have a vps setup with proxy configured to redirect to my home server via vpn.
How do I disable port 80 so when the user types in browser http://my.domain he will be redirected to https://my.domain ? Or how do I enable secure connection only ?
As an example look at http://vk.com - even when you open http link it creates secure https connection.
If I just keep <VirtualHost *:443> and remove <VirtualHost *:80> from /etc/apache2/sites-available/myconf.conf it shows default apache2 page when I open http://my.domain
I found solution.
<VirtualHost *:80>
ServerName my.domain
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>