title: Apache2 - how to close port 80 entirely and force the browser to automatically use HTTPS?
body: <p>I'm running the newest Debian Wheezy and I'm configuring an Apache2 server with phpMyAdmin running, not more. I have installed a self-signed certificate by:</p>
  
  <ol>* Removing <b>default</b> file in <b>/etc/apache2/sites-available</b></ol>
  
  <ol>* Modifying <b>default-ssl</b> file to add paths for certificate and certificate key</ol>
  
  <ol>* Renaming <b>default-ssl</b> to <b>default</b></ol>
  
  <ol>* service apache2 restart</ol>
  
  <p>Certificate is indeed working but not quite as I have expected.<br /> 
  <b>My goal is to shut down port 80 for Apache entirely and to make the browser use HTTPS automatically for any sites, including phpMyAdmin.</b> The first problem is that I have to manually add <i>https://</i> in URL to be able to open a default site from <i>/var/www</i> - I expected it to redirect automatically to HTTPS. The second one is phpMyAdmin not working really well with SSL. When I open <code>http://10.0.0.8/phpmyadmin</code> in my browser, site opens without SSL certificate and after I try to log in, it redirects me to <code>http://10.0.0.8/phpmyadmin/index.php</code> which results in the browser showing "Connection Refused". After opening the site with <i>https://</i> instead, everything is working perfectly.<br />
  What have I done for now is I commented two first lines in <b>ports.conf</b> to turn off listening in port 80. Also I tried to force phpMyAdmin to use SSL by adding <code>$cfg['ForceSSL'] = true;</code> in <b>config.inc.php</b> and making a .htaccess file to redirect the user to SSL site with <code>Redirect permanent /phpmyadmin https://10.0.0.8/phpmyadmin</code><br />
  How can I achieve that?</p>