edoceo

Configuration of Apache with SSL

Sample Apache configurations to force SSL for a specific site or for specific web-paths or directories.

Force Site-Wide SSL

The easist of configurations is the force SSL for the entire site.

# Host to Listen on Port 80
<VirtualHost 216.162.208.161:80>
    ServerName ssl.edoceo.com
    RewriteEngine On
    RewriteRule (.*) https://edoceo.com$1 [R=301,L]
</VirtualHost>

# actual ssl site
<VirtualHost 216.162.208.161:443>

    DocumentRoot /var/www/ssl.edoceo.com
    ServerName edoceo.com

    SSLEngine on
    SSLOptions +StdEnvVars
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /etc/apache2/ssl/edoceo.com.crt
    SSLCertificateKeyFile /etc/apache2/ssl/edoceo.com.key-open

<VirtualHost>

Force Site-Path SSL

This this configuration SSL traffic is only enforced for specific URI-paths on the host.

# The Site
<VirtualHost 216.162.208.161:80>

    ServerName edoceo.com
    
    # Only Rewrite If SSL Off
    RewriteCond %{HTTPS} off
    RewriteRule (/login.*) https://edoceo.com$1 [R=301,L]
    RewriteRule (/logout.*) https://edoceo.com$1 [R=301,L]
    RewriteRule (/checkout.*) https://edoceo.com$1 [R=301,L]

<VirtualHost>

Other

Loading Comments from Disqus...