关于apache下同IP多域名支持HTTPS和80跳转HTTPS的配置-阿里云开发者社区

开发者社区> 安全> 正文

关于apache下同IP多域名支持HTTPS和80跳转HTTPS的配置

简介:

httpd-ssl的配置:

Listen 443

NameVirtualHost *:443

 

AddType application/x-x509-ca-cert .crt

AddType application/x-pkcs7-crl    .crl

 

SSLPassPhraseDialog  builtin SSLSessionCache        "shmcb:/usr/local/apache/logs/ssl_scache(512000)"

SSLSessionCacheTimeout  300

SSLMutex  "file:/usr/local/apache/logs/ssl_mutex"

 

<VirtualHost *:443>

DocumentRoot "/xxxx/Span"

ServerName resource-pov.xxx.com

SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

SSLCertificateFile "/usr/local/apache/conf/ssl/server.crt"

SSLCertificateKeyFile "/usr/local/apache/conf/ssl/server.key"

</VirtualHost>

 

<VirtualHost *:443>

DocumentRoot "/xxxx/pov.xxx.com"

ServerName pov.xxx.com

SSLEngine on

SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

SSLCertificateFile "/usr/local/apache/conf/ssl/server.crt"

SSLCertificateKeyFile "/usr/local/apache/conf/ssl/server.key"

</VirtualHost>

 

httpd-vhosts.conf的配置:

NameVirtualHost *:80

<VirtualHost *:80>    

ServerAdmin webmaster@dummy-host.example.com    

DocumentRoot "/xxxx/Span"    

ServerName  resource-pov.xxx.com    

ServerAlias resource-pov.xxx.com

<IfModule mod_rewrite.c>  

RewriteEngine On  

RewriteCond %{SERVER_PORT} 80  

RewriteRule ^(.*)$ https://resource-pov.xxx.com/$1 [R=301,L]

</IfModule>

    ErrorLog "logs/resource-pov.xxx.com-error_log"    

    CustomLog "logs/resource-pov.xxx.com-access_log" common

</VirtualHost>

 

<VirtualHost *:80>    

ServerAdmin webmaster@dummy-host.example.com    

DocumentRoot "/xxxx/pov.xxx.com"    

ServerName  pov.xxx.com    

ServerAlias pov.xxx.com

<IfModule mod_rewrite.c>    //这块IfModule mod_rewrite.c是开启重定向跳转模块,将所有80的访问跳转至HTTPS,如果不想跳转可以选择去掉<IfModule mod_rewrite.c> ........ </IfModule> 这段。

RewriteEngine On  

RewriteCond %{SERVER_PORT} 80  

RewriteRule ^(.*)$ https://pov.xxx.com/$1 [R=301,L]

</IfModule>    

ErrorLog "logs/pov.xxx.com-error_log"    

CustomLog "logs/pov.xxx.com-access_log" common

</VirtualHost>


     本文转自yzy121403725 51CTO博客,原文链接:http://blog.51cto.com/lookingdream/1870152,如需转载请自行联系原作者





版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
+ 订阅

云安全开发者的大本营

其他文章