ApacheサーバーでHTTPSを使用すると機能しない

ApacheサーバーでHTTPSを使用すると機能しない

私のサーバーwww.tripmatcher.comでは、次のような問題が発生しています。Apache httpd が、名前ベースの仮想ホストは SNI 対応のブラウザでのみ機能すると通知するのはなぜですか (RFC 4366)私の設定ファイルは /etc/apache2/sites-enabled/default-ssl.conf にあり、次のようになっています。

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerName tripmatcher.com
        RewriteEngine on
        RewriteCond %{HTTP_HOST} ^tripmatcher.com
        RewriteRule ^/(.*)$ http://www.tripmatcher.com/$1 [L,R=301]

        ServerAdmin [email protected]
        DocumentRoot /var/www/html
        <Directory "/var/www/html">
        AllowOverride All
        </Directory>

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
       # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example # the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

<VirtualHost *:443>

ServerAdmin [email protected]

DocumentRoot /var/www/html
<Directory "/var/www/html">
        AllowOverride All
        </Directory>


ServerName tripmatcher.com

ErrorLog ${APACHE_LOG_DIR}/error.log

SSLEngine on

SSLCertificateFile /etc/ssl/tripmatcher.crt

SSLCertificateKeyFile /etc/ssl/tripmatcher.key

SSLCertificateChainFile /etc/ssl/tripmatcher.ca-bundle

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

私の見る限り、これは問題ないようです。何が間違っているのか誰か指摘してくれませんか?問題は私がhttps://www.tripmatcher.com、CSSが一部欠けているものの、ページは読み込まれます。しかし、ログインして、例えばhttps://tripmatcher.com/matcher「要求された URL /matcher はこのサーバー上に見つかりませんでした。」というメッセージが表示されます。何が問題なのか説明していただけますか?

[Sun Dec 10 22:23:25.578086 2017] [ssl:warn] [pid 19647] AH02292: Init: 名前ベースの SSL 仮想ホストは、TLS サーバー名表示サポート (RFC 4366) を持つクライアントに対してのみ機能します [Sun Dec 10 22:23:25.580546 2017] [mpm_prefork:notice] [pid 19647] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.20 OpenSSL/1.0.1f が構成されました -- 通常の操作を再開します [Sun Dec 10 22:23:25.580590 2017] [core:notice] [pid 19647] AH00094: コマンド ライン: '/usr/sbin/apache2'

ログでそれがわかります。

答え1

.htaccess の先頭を変更するだけで問題は解決しました。

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.tripmatcher.com/index.php/$1 [R,L]
#RewriteRule

この問題を抱えている他の人にとって、これが役に立つことを願っています。

関連情報