2016-09-07 3 views
0

Apache 2.4로 URL 재 작성을 시도하고 있습니다. 나는하지 않는 SSL 와일드 카드 인증서에 오류를 피하기 위해 요청에https로 Apache 2.4 URL 재 작성

  1. http://subdomain.domain.com
  2. http://www.subdomain.domain.com
  3. https://www.subdomain.domain.com

https://subdomain.domain.com

에 매핑되는 것을 원하는 www가 일치하지 않습니다. subdomain.domain.com.

<VirtualHost ip:80> 
     ServerName subdomain.domain.com 
     RewriteEngine On 
     RewriteCond %{HTTPS} off 
     RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}  
    </VirtualHost> 
    <VirtualHost ip:80> 
     ServerName www.subdomain.domain.com 
     Redirect permanent/https://subdomain.domain.com 
    </VirtualHost> 
    <VirtualHost ip:443> 
     ServerName www.subdomain.domain.com 
     Redirect permanent/https://subdomain.domain.com 
    </VirtualHost> 
    <VirtualHost ip:443> 
     ServerName subdomain.domain.com 
     ... 
     ... 
     ... 

내 구성이 작동 (1)과 (2)가 아니라 (3) :

내가 함께했습니다. 내 실수는 어디 갔지?

답변

1

문제는 포트 443 가상 호스트 중 하나에 SSL이없는 것입니다. 이 암호화 있기 때문에

는, 그렇지 않으면, 요청이 단순히 이해되지 않습니다이

<VirtualHost ip:443> 
    ServerName www.subdomain.domain.com 
    Redirect permanent/https://subdomain.domain.com 
    SSLEngine on 
    SSLCertificateFile /something 
    SSLCertificateKeyFile /something 
</VirtualHost> 

보십시오.

이유가 필요한 이유는 How to redirect https to http without any SSL Certificate을 참조하십시오.

+0

작동하지 않습니다. SSL 인증서가 해당 일반 이름에 유효하지 않다는 것을 보여주는 요청이 실제로 브라우저에서 이해됩니다. – drenda

+0

변경 사항 이전에 이미보고있는 내용이면 * .subdomain.com과 일치하는 구성에서 아파치 설정 블록이 더 높을 수도 있습니다. 즉, 귀하의 질문에 config 블록이 적용되지 않습니다. –

+1

@drenda @Chris에 언급 된 답변을 읽어보십시오. 올바른 인증서없이 'https : //'요청에 대해 (경고없이) 응답 할 수있는 방법은 없습니다. 즉 프로토콜이 작동하는 방식입니다. –