首页 > 解决方案 > 在带有 apache2 的 ubuntu 上使用 SSL 证书会导致 ERR_ADDRESS_UNREACHABLE

问题描述

尝试使用我从提供商处获得的 ssl 证书和密钥,但没有成功。当我想连接到我的网站时,我会ERR_ADDRESS_UNREACHABLE在 Google Chrome 中获得一个。

在此处输入图像描述

这是我的网站的 Apache 配置。

    <VirtualHost *:80>
            ServerName example.com
            ServerAlias *.example.com

            ServerAdmin me@example.com
            DocumentRoot /var/www/example.com/public

            Redirect "/" "https://example.com/"

            ErrorLog ${APACHE_LOG_DIR}/example.com.error.log
            CustomLog ${APACHE_LOG_DIR}/example.com.access.log combined
    </VirtualHost>

    <IfModule mod_ssl.c>
            <VirtualHost *:443>
                    ServerName example.com
                    ServerAlias *.example.com

                    ServerAdmin me@example.com
                    DocumentRoot /var/www/example.com/public

                    SSLEngine on

                    SSLCertificateFile      /etc/ssl/certs/example.com.crt
                    SSLCertificateKeyFile   /etc/ssl/private/example.com.key

                    <Directory /var/www/example.com/>
                            Options Indexes FollowSymLinks MultiViews
                            AllowOverride All
                            Order allow,deny
                            allow from all
                            <Limit POST PUT DELETE>
                                    Require all granted
                            </Limit>
                    </Directory>

                    ErrorLog ${APACHE_LOG_DIR}/example.com.error.log
                    CustomLog ${APACHE_LOG_DIR}/example.com.access.log combined
            </VirtualHost>
    </IfModule>

我还确保防火墙允许 https 连接。

在此处输入图像描述

我在这里想念什么?

标签: apachessl

解决方案


好的,奇怪的是我的服务器上确实没有启用 ssl/https/port 443。不知道为什么一切都告诉我启用了 https,但这是我可以为我解决的方法。

iptables -I INPUT -p tcp --dport 443 -j ACCEPT

推荐阅读