在Ubuntu上通过SSL的Apache ERR_CONNECTION_REFUSED

Leo*_*eel 3 apache ubuntu ssl

我正在尝试在Ubuntu上设置Apache(2.4)服务器。目前,我只是试图从中提供静态页面/var/www/html(尽管最终我想运行WSGI Python应用程序)。

这是我的sites-available/website.conf档案:

<VirtualHost *:443>
        ServerAdmin email@gmail.com
        ServerName website.com:443
        SSLEngine on
        SSLCertificateFile /root/website.csr
        SSLCertificateKeyFile /root/website.key
        DocumentRoot /var/www/html
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

(将我的实际域名替换为“网站”。)

当我尝试通过转到我的域名或服务器的IP地址连接到此服务器时,Chrome会给我ERR_CONNECTION_REFUSED(“无法访问此站点”)。

我也尝试使用telnet:

root@website:/etc/apache2# telnet localhost 443
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
Run Code Online (Sandbox Code Playgroud)

当我从配置文件中注释掉所有与SSL有关的行时,我可以通过telnet进行连接,但是Chrome可以为我提供服务ERR_SSL_PROTOCOL_ERROR(“该站点无法提供安全的连接”,我认为这很有意义)。

这也是我的ports.config,如果有帮助的话:

Listen 80

<IfModule ssl_module>
        Listen 443
        NameVirtualHost *:443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>
Run Code Online (Sandbox Code Playgroud)

(是,已启用SSL模块。)

apache2.conf我经常看到的我的部分在类似的问题中被引用:

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
Run Code Online (Sandbox Code Playgroud)

这是我第一次设置Apache服务器,所以我想我在弄乱一些简单的东西吗?

小智 5

检查是否在此处激活了ssl模式:

须藤a2enmod ssl

sudo服务apache2重新启动