启用ssl时无法访问网站

时间:2016-12-15 10:19:49

标签: apache ssl ubuntu-16.04 ubuntu-server

我们正在尝试在我们的网站上使用SSL。 该网站位于ubuntu服务器2016上。我已经通过let加密生成了证书并遵循了ubuntu教程,但最后我得到了ERR_CONNECTION_REFUSED

<VirtualHost *:443>

    ServerAdmin webmaster@sitename.eu
    ServerName dp7.sitename.eu
    ServerAlias www.dp7.sitename.eu

    #SSLEngine on
    #SSLCertificateFile      /etc/letsencrypt/live/sitename.fr/cert.pem
    #SSLCertificateChainFile /etc/letsencrypt/live/sitename.fr/fullchain.pem
    #SSLCertificateKeyFile  /etc/letsencrypt/live/sitename.fr/privkey.pem
        DocumentRoot /var/www/bt750
        <Directory "/var/www/bt750">
            Options +FollowSymLinks -MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
        Require all granted
        </Directory>
    ErrorLog /var/log/apache2/dp7_ssl_error.log
    LogLevel warn
    CustomLog /var/log/apache2/dp7_ssl_access.log "combined"
</VirtualHost>

我已刷新所有Chrome缓存,但没有成功

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

您在apache配置中遇到一些错误。您需要Listen 443端口并取消注释SLL配置

Listen 443
<VirtualHost *:443>

    ServerAdmin webmaster@sitename.eu
    ServerName dp7.sitename.eu
    ServerAlias www.dp7.sitename.eu

    SSLEngine on
    SSLCertificateFile      /etc/letsencrypt/live/sitename.fr/cert.pem
    SSLCertificateChainFile /etc/letsencrypt/live/sitename.fr/fullchain.pem
    SSLCertificateKeyFile  /etc/letsencrypt/live/sitename.fr/privkey.pem
        DocumentRoot /var/www/bt750
        <Directory "/var/www/bt750">
            Options +FollowSymLinks -MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
        Require all granted
        </Directory>
    ErrorLog /var/log/apache2/dp7_ssl_error.log
    LogLevel warn
    CustomLog /var/log/apache2/dp7_ssl_access.log "combined"
</VirtualHost>