Apache HTTPS 不起作用,HTTP 起作用

Apache HTTPS 不起作用,HTTP 起作用

操作系统:Ubuntu Server 20.40。Web
服务器:Apache2
SSL:OpenSSL

SSL 模块已启用
SSL 文件已复制到服务器上
SSL 站点已配置(代码上方)
Apache 语法:确定
防火墙:已禁用

HTTP 请求有效
HTTPS 请求无效(超时)

我遗漏了一些步骤还是怎么的?
你能帮我吗?

<VirtualHost *:80>

        ServerName [server name]
        ServerAlias [server alias with 'www' prefix]
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/[website path]/public_html

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

</VirtualHost>

<VirtualHost _default_:443>

        ServerName [same server name]
        ServerAlias [same server alias]
        ServerAdmin webmaster@localhost
        DocumentRoot [same root]
        SSLEngine on
        SSLCertificateFile /ssl/website_cert.crt
        SSLCertificateKeyFile /ssl/myserver.key

</VirtualHost>

答案1

我认为你的 443 虚拟主机不正确,请尝试这个

<VirtualHost *:443>

        ServerName [same server name]
        ServerAlias [same server alias]
        ServerAdmin webmaster@localhost
        DocumentRoot [same root]
        SSLEngine on
        SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
        SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
        SSLHonorCipherOrder On  
        SSLCertificateFile /ssl/website_cert.crt
        SSLCertificateKeyFile /ssl/myserver.key
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
      
</VirtualHost>

相关内容