1

EC2 インスタンスの 1 つで https をセットアップしようとしています。私はこれを何度も行ってきましたが、何らかの理由で、この例では機能しません。

問題

ローカル IP 経由でドメインに接続すると、https は正常に機能します。パブリック IP 経由でドメインに接続すると、https が機能せず、ブラウザーの応答が"ERR CONNECTION REFUSED"になります。

時々リロードすると、https が受け入れられたことがわかりますが、ファイアウォール ルールがあるかのようにすぐにブロックされますが、ファイアウォール ルールはありません。

通常の http は 100% ローカルおよびパブリックに機能します。

この段階では、Amazon のセキュリティ グループを介してポートをブロックしていません。IP テーブルに関するルールはなく、ufw を無効にしました。

Apache の SSL を有効にしましたが、テスト キーはローカルで正常に動作します。

これは sudo netstat -tlnp の出力です

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      937/sshd
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1060/mysqld
tcp6       0      0 :::22                   :::*                    LISTEN      937/sshd
tcp6       0      0 :::443                  :::*                    LISTEN      2798/apache2
tcp6       0      0 :::80                   :::*                    LISTEN      2798/apache2

これは私の /etc/apache2/ports.conf ファイルです:

Listen 80
Listen 443

エラーなしで default-ssl サイトを有効にしました。

これは私の /etc/hosts ファイルです:

127.0.0.1 localhost


# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

また、127.0.0.0 の代わりに 0.0.0.0 を使用してみましたが、何もしませんでした。

これは、Apache 用の私の Web サイトの conf ファイルです (セキュリティ上の理由から、実際のサイト名を「mysite.com」に置き換えました)。

<VirtualHost *:80>
     DocumentRoot /var/www/html/mysite.com
     ServerName mysite.com
     ServerAlias www.mysite.com
        <Directory /var/www/html/mysite.com>
                AllowOverride All
                RewriteEngine On
                Require all granted
                Options -Indexes +FollowSymLinks
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
     DocumentRoot /var/www/html/mysite.com
     ServerName mysite.com
     ServerAlias www.mysite.com
     SSLEngine on
     SSLCertificateFile /usr/local/ssl/public.crt
     SSLCertificateKeyFile /usr/local/ssl/private/private.key
     SSLCACertificateFile /usr/local/ssl/intermediate.crt
</VirtualHost>

このまったく同じ conf ファイルが別のインスタンスで動作していたため、このファイルに問題がないことがわかりました。

何が欠けていますか?助けてください。前もって感謝します

編集

Apache用にロードされたモジュールは次のとおりです。

sudo apache2ctl -M
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)
 wsgi_module (shared)

編集2

サービスを再起動したときではなく、数分前にランダムに発生したいくつかの興味深い apache error.log エントリ (これが問題の原因でしょうか?):

[Wed Feb 17 21:04:48.478106 2016] [ssl:warn] [pid 3629] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Wed Feb 17 21:04:48.507277 2016] [ssl:warn] [pid 3630] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Wed Feb 17 21:04:48.507324 2016] [:warn] [pid 3630] mod_wsgi: Compiled for Python/3.4.0.
[Wed Feb 17 21:04:48.507329 2016] [:warn] [pid 3630] mod_wsgi: Runtime using Python/3.4.3.
[Wed Feb 17 21:04:48.509502 2016] [mpm_prefork:notice] [pid 3630] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.14 OpenSSL/1.0.1f mod_wsgi/3.4 Python/3.4.3 configured -- resuming normal operations
[Wed Feb 17 21:04:48.509517 2016] [core:notice] [pid 3630] AH00094: Command line: '/usr/sbin/apache2'

それが私の問題ではないことを確認するためだけにwsgiモジュールを無効にし、Apacheサービスを再起動しましたが、それでも運が悪く、同じ問題です。

編集3

詳細情報を表示するために、phpinfo() の一部をダンプしています。SSL は YES に設定されています。何が起こっているのかわかりません:(

ここに画像の説明を入力

編集4

これを機能させるには、ロードバランサーに SSL 証明書を追加する必要があると思います。私は今それを試しています、みんなに知らせます...

4

2 に答える 2

0

ログを添付して Apache エラー出力を表示することもできますか?

仮想ホストの順序を変更し、最初に 443 を配置します。

これによって影響を受ける可能性があります: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/795315

于 2016-02-17T20:41:29.077 に答える