使用SSL证书会在ubuntu上使用apache2导致ERR_ADDRESS_UNREACHABLE

时间:2018-05-06 15:34:44

标签: apache ssl

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

enter image description here

这是我的网站Apache Config。

    <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连接。

enter image description here

我在这里缺少什么?

1 个答案:

答案 0 :(得分:1)

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

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