【问题标题】:Apache 2.4 SSL Config - Server rejects requests with HTTP 400Apache 2.4 SSL 配置 - 服务器拒绝 HTTP 400 的请求
【发布时间】:2016-04-19 14:13:51
【问题描述】:

我的 Apache 2.4 配置遇到了一些问题。访问 https://subdomain.my-domain.com 总是返回这个 http 400。

Bad Request 您的浏览器发送了此服务器无法发送的请求 理解。原因:您对启用 SSL 的用户使用纯 HTTP 服务器端口。请改用 HTTPS 方案访问此 URL。

我直接通过 https 访问我的网站,因此不涉及从 http 到 https 的重定向。在我的 apache 配置下方。我知道我不检查证书的有效性。现在他们只是自签名,但将来会改变。

##################################################################
###                                                            ###
###   Global Settings                                          ###
###                                                            ###
##################################################################

    DocumentRoot /var/ebc/apache2/www/htdocs
    <Location /fwcheck.html>
        <RequireAll>
            Require all granted
        </RequireAll>
    </Location>

##################################################################
###                                                            ###
###   Global SSL Settings                                      ###
###                                                            ###
##################################################################

    SSLProtocol             ALL -SSLv2 -SSLv3
    SSLProxyProtocol        ALL -SSLv2 -SSLv3
    SSLHonorCipherOrder     on
    SSLCipherSuite          ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:HIGH:!MD5:!aNULL:!EDH
    SSLCompression          off
    SSLSessionTickets       off

    # OCSP Stapling, only in httpd 2.3.3 and later
    SSLUseStapling                      on
    SSLStaplingResponderTimeout         5
    SSLStaplingReturnResponderErrors    off
    SSLStaplingCache                    shmcb:/var/ebc/apache2/sslstaplingcache(128000)

##################################################################
###                                                            ###
###   Virtual Hosts                                            ###
###                                                            ###
##################################################################

<VirtualHost 10.173.144.43:80>
    ErrorLog /var/ebc/apache2/log/error.log
    CustomLog /var/ebc/apache2/log/access.log vhost_combined

    ##################################################################
    ###                                                            ###
    ###   Send everything to https except firewall check           ###
    ###   vhost config only for port 443 necessary.                ###
    ###   No further config for port 80.                           ###
    ###                                                            ###
    ##################################################################

        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !fwcheck.html
        RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

    ##################################################################
</VirtualHost>

<VirtualHost 10.173.144.43:443>
    ServerName subdomain.my-domain.com
    ErrorLog /var/ebc/apache2/log/error.log
    CustomLog /var/ebc/apache2/log/access.log vhost_combined

    ##################################################################
    ###                                                            ###
    ###   SSL Settings                                             ###
    ###                                                            ###
    ##################################################################

        RequestHeader set ClientProtocol HTTPS
        SSLEngine       On
        SSLProxyEngine  On

        SSLCertificateFile      /var/ebc/apache2/ssl/subdomain.my-domain.com.crt
        SSLCertificateKeyFile   /var/ebc/apache2/ssl/subdomain.my-domain.com.key
        SSLCACertificateFile    /var/ebc/apache2/ssl/subdomain.my-domain.com.crt

        ProxyRequests       off
        ProxyPreserveHost   on

        # Disable certificate checks
        SSLProxyCheckPeerCN off
        SSLProxyCheckPeerName off

        # HSTS (15768000 seconds = 6 months)
        Header always set Strict-Transport-Security "max-age=15768000"

    ##################################################################
    ###                                                            ###
    ###   Locations                                                ###
    ###                                                            ###
    ##################################################################

        DocumentRoot /var/ebc/apache2/www/htdocs/prod

        <Location />
            Options None
            <RequireAll>
                Require all granted
            </RequireAll>
        </Location>

        <Location /web-status>
            <RequireAll>
                Require all denied
            </RequireAll>
        </Location>

        <Location /balancer-manager>
            <RequireAll>
                Require all denied
            </RequireAll>
        </Location>

    ##################################################################
</VirtualHost>

我真的不知道为什么这不起作用。谁能给个提示?

在此先感谢大家并问候塞巴斯蒂安

【问题讨论】:

标签: apache ssl apache2.4


【解决方案1】:

您的连接未到达接口 10.173.144.43:443,因此您的VirtualHost 不会处理它。它命中未启用 SSL 的主服务器配置。

如果您不关心使用什么本地接口,请在VirtualHost 中使用 *

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-06
    • 2020-10-08
    • 2016-04-13
    • 2012-05-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多