문제

내 구성은 다음과 같습니다.

Listen 443 http
NameVirtualHost *:80
NameVirtualHost *:443
ServerName *:80

<VirtualHost *:80> 
  [some non-ssl stuff]
  ServerName account.example.com
</VirtualHost>

<VirtualHost *:443> 
  [some non-ssl stuff(directory, docroot)] 
  ServerName account.example.com
  SSLEngine on
  SSLCertificateFile /Users/myusername/certs/server.crt
  SSLCertificateKeyFile /Users/myusername/certs/server.key
</VirtualHost>

따라서 내 사이트의 HTTP 버전에 액세스 할 수는 없지만 SSL 버전이 올바르게 작동합니다. 나는 mod_rewrite를 통해 vhosts, http (80) 및 https (443)를 모두 사용하고 싶습니다.

uname -a
Linux 3.4.62-53.42.amzn1.x86_64 GNU/Linux

httpd -v
Server version: Apache/2.2.25 (Unix)

내가 잘못하고있는 일을 이해하도록 도와주세요.

도움이 되었습니까?

해결책

그래서 지금 내 구성은 다음과 같습니다.

Listen 443 http
Listen 80
NameVirtualHost *:80
NameVirtualHost *:443
ServerName *:80

<VirtualHost *:443> 
  [some non-ssl stuff(directory, docroot)] 
  ServerName account.example.com
  SSLEngine on
  SSLCertificateFile /Users/myusername/certs/server.crt
  SSLCertificateKeyFile /Users/myusername/certs/server.key
</VirtualHost>

<VirtualHost *:80>
  SSLEngine off
  [other stuff like docroot]
</VirtualHost>

확실하지 않습니다 SSLEngine off, 그러나 지금은 작동합니다. 따라서 http vhost의 .htaccess 파일에서 http에서 https로 리어 리어 리어 리어 리그 리더를 추가합니다.

#Redirrect from http to https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top