Moving Port 80 Connections to 443

by mike on January 7, 2009

Server with SSL Moving port 80 to 443

Here is an example of what you could do when you have a server that is running SSL and you still have users trying to access it on port 80 and you want them to be automatically moved to port 443.  Now this example is assuming that you do not have other virtual hosts as SSL will not work with NameBased Hosting.

<VirtualHost 192.168.7.56:443>
ServerAdmin  admin@example.com
DocumentRoot /var/www/html
ServerName example.com
ServerAlias www.example.com
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/example.com.crt
SSLCertificateKeyFile /etc/pki/tls/private/server.key
SSLCertificateChainFile /etc/pki/tls/certs/gd_bundle.crt
ErrorLog logs/example.com-error_log
CustomLog logs/example.com-access_log common
</VirtualHost>
<VirtualHost example.com:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html
ServerName example.com
RewriteEngine On
RewriteRule ^(.*)$ https://example.com/$1 [L,R]
</VirtualHost>

  • Share/Bookmark

{ 1 trackback }

Technology » Blog Archive » Secure Certificate Hack Doesn’T Imperil Users | Technology
January 7, 2009 at 7:25 am

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: