【问题标题】:Site loading on port 443 and not on 80在端口 443 而不是 80 上加载站点
【发布时间】:2019-12-11 20:05:59
【问题描述】:

我的网站在 SSL 证书上运行不正常。 该网站在我的配置文件中使用 SSLEngine off 指令的 443 端口上正常工作,SSLEngine on 响应 503 错误。 它还默认连接到端口 80,我真的不知道在哪里更改它,因为我到处都设置了端口 443。

.htaccess 文件:

RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ https://www.antoszbk.xyz/$1 [R,L]

配置文件(正常工作时):

    <VirtualHost *:443>
        ServerAdmin xxx@xxx.com

        DocumentRoot /var/www/html/index.html
        ServerName antoszbk.xyz

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

        #   SSL Engine Switch:
        #   Enable/Disable SSL for this virtual host.
        SSLEngine off

        SSLCertificateFile  /etc/ssl/certs/www.antoszbk.xyz.csr
        SSLCertificateKeyFile /etc/ssl/private/www.antoszbk.xyz.key

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
                SSLOptions +StdEnvVars
        </Directory>

        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        # MSIE 7 and newer should be able to use keepalive
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

    </VirtualHost>

【问题讨论】:

  • “默认情况下它也在端口 80 上连接” - “它”是使用纯 HTTP 作为默认浏览器,其中没有显式协议(如 https://)给定的。

标签: html ssl websocket apache2


【解决方案1】:

解决方案在 DNS 服务器配置中。 提供商提供给我的证书设置为 antoszbk.xyz 别名,但在我的 SSL 配置中,我将其设置为 www.antoszbk.xyz。如果尝试通过 IPv6(AAAA 记录)重定向连接仍然会收到错误,但 DNS 处理它只是时间问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-17
    • 1970-01-01
    • 2021-04-06
    • 2019-02-02
    • 2012-03-01
    • 2014-08-16
    • 2017-10-29
    • 1970-01-01
    相关资源
    最近更新 更多