Linux apache环境下配置多个ssl证书搭建多个站点 https强制301到https

Listen 443
#Listen 8081
NameVirtualHost *:443
SSLStrictSNIVHostCheck off


DocumentRoot "/web/domain.com"
ServerName domain.com
ServerAlias www.domain.com
ServerAdmin [email protected]
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLCertificateFile "/usr/local/apache/cert/domain_public.pem"
SSLCertificateKeyFile "/usr/local/apache/cert/domain.key"
SSLCertificateChainFile "/usr/local/apache/cert/domain_chain.pem"

    SSLOptions +StdEnvVars


    AllowOverride All
    SSLOptions +StdEnvVars





DocumentRoot "/web/domain2.com"
ServerName domain2.com
ServerAlias www.domain2.com
RewriteEngine On
RewriteRule ^/(.*)$ https://www.domain.com/$1 [R=301,L]
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLCertificateFile "/usr/local/apache/cert/domain2_public.pem"
SSLCertificateKeyFile "/usr/local/apache/cert/domain2.key"
SSLCertificateChainFile "/usr/local/apache/cert/domain2_chain.pem"

    SSLOptions +StdEnvVars


    AllowOverride All
    SSLOptions +StdEnvVars

由于需求问题 需要再443端口下做301 折腾好久 终于弄好了!

其中https://www.domain2.com强制301到https://www.domain.com上

你可能感兴趣的:(ssl)