Apache、vhost、リダイレクト、https、ssl の問題

Apache、vhost、リダイレクト、https、ssl の問題

問題:

これらのエラーに対する書き換えログにはエントリがありません。

vhost 構成

<VirtualHost 127.0.1.3:80>
ServerAdmin [email protected]
ServerName www.example.com

DocumentRoot /var/www/html
<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride All


    Order allow,deny
    Allow from all
</Directory>


Redirect permanent /fundprocess.html https://example.com/fundprocess.html
Redirect permanent /fund_process.php https://example.com/fund_process.php

ErrorLog /var/log/apache2/example.com-error_log
TransferLog /var/log/apache2/example.com-access_log
LogLevel warn

RewriteLog /var/log/apache2/example.com-rewrite_log
RewriteLogLevel 9



</VirtualHost>


<VirtualHost 127.0.1.2:80>
ServerAdmin [email protected]
ServerName example.com
DocumentRoot /var/www/html

    RewriteCond %{REQUEST_URI} !fundprocess.html [NC]
    RewriteCond %{REQUEST_URI} !fund_process.php [NC]
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]

    RewriteCond %{REQUEST_URI} fundprocess.html [NC]
    RewriteCond %{REQUEST_URI} fund_process.php [NC]
    RewriteRule (.*) https://example.com/$1 [R=301,L]



</VirtualHost>



<VirtualHost 127.0.1.3:443>
ServerAdmin [email protected]
ServerName www.example.com
DocumentRoot /var/www/html

    RewriteCond %{REQUEST_URI} !fundprocess.html [NC]
    RewriteCond %{REQUEST_URI} !fund_process.php [NC]
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]

    RewriteCond %{REQUEST_URI} fundprocess.html [NC]
    RewriteCond %{REQUEST_URI} fund_process.php [NC]
    RewriteRule (.*) https://example.com/$1 [R=301,L]


</VirtualHost>



<VirtualHost 127.0.1.2:443>
ServerAdmin [email protected]
ServerName example.com


DocumentRoot /var/www/html
<Directory /var/www/html>

    Options Indexes FollowSymLinks
    AllowOverride All


    Order allow,deny
    Allow from all

 </Directory>


RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !fundprocess.html [NC]
RewriteCond %{REQUEST_URI} !fund_process.php [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

ErrorLog /var/log/apache2/example.com-ssl-error_log
TransferLog /var/log/apache2/example.com-ssl-access_log
LogLevel warn

RewriteLog /var/log/apache2/example.com-rewrite_log
RewriteLogLevel 9


SSLEngine On
SSLCertificateFile /etc/certs/example.crt
SSLCertificateKeyFile /etc/certs/example.key


SetEnvIf User-Agent ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

</VirtualHost>

答え1

これはリダイレクトの問題ではなく、SSL の問題です (リダイレクトが行われる前にリクエストを復号化する必要があります)。

Apache の設定のどこかにありますかListen 443? ない場合は、Listen 80 の部分の近くに挿入してください。このサーバーで他の SSL ウェブサイトを実行していますか? 同じ IP アドレスを使用していないことを確認してください。最後に、他の場所で機能する SSL 証明書がある場合は、このサイトで使用してみてください。ブラウザーに警告が表示されますが、警告を受け入れるとリダイレクトされるはずです。つまり、問題は SSL 証明書にあることがわかります。

答え2

ssl_error_rx_record_too_long は、Apache が SSL を期待しているのに HTTP を受信したときに発生します。

すべてのポート 443 要求が で仮想ホストに届くようにしてくださいSSLEngine On。 を修正する必要があります<VirtualHost 127.0.1.3:443>

また、証明書は example.com と *.example.com の両方で機能する必要があります。そうでない場合、クライアントはリダイレクトではなく、見苦しい警告を受け取ります。

関連情報