LAMP下添加支持openssl的主机

1. 首先确保您的Apache服务器已经支持OpenSSL

NameVirtualHost *:443
<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName webname.com:443
    SSLEngine on
    SSLCertificateFile "/etc/pki/tls/certs/localhost.crt"
    SSLCertificateKeyFile "/etc/pki/tls/private/localhost.key"
    DocumentRoot /data/www/webname
    <Directory /data/www/webname>
        Options FollowSymLinks Indexes
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

2. 将http协议头网站301到https协议头

RewriteEngine On
RewriteCond %{HTTPS} !on [NC]
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

 

posted @ 2014-05-13 10:19  smismile  阅读(221)  评论(0编辑  收藏  举报