https 即使在 ssl 设置之后也不提供内容,但是 http 可以

https is not serving content even after ssl setup, but http does

我在 RHEL 7 服务器的端口 8000 上有一个 docker 容器 运行 Jupyter notebook,当我通过 http://server-name:8000 访问它时,它似乎非常好。

但是,当我尝试在 apache 网络服务器上配置 ssl 证书时,内容未在 https

上提供

我的配置文件如下。

Listen 443 https
<VirtualHost *:443>  
    ServerName server.com
    SSLEngine on
    SSLCertificateFile /path/to/cerfile.cer
    SSLCertificateKeyFile /path/to/Keyfile.key
    ProxyPass / https://server.com:8000/tree
    ProxyPassReverse / https://server.com/8000/tree                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
</VirtualHost>

I am not able to access https://server.com:8000/tree individually, however i am able to access http://server.com:8000/tree

并不是我的证书不起作用,当我在上面的配置中删除 ProxyPass 时,我可以访问 https://server.com

<VirtualHost *:443>  
    ServerName server.com
    SSLEngine on
    SSLCertificateFile /path/to/cerfile.cer
    SSLCertificateKeyFile /path/to/Keyfile.key                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
</VirtualHost>

我不确定为什么我的内容无法在 https 下加载,有人可以解释一下吗?

尝试到达 https://server-name:8000/tree

时接收错误

This site can’t be reached server-name took too long to respond. Try:

Checking the connection Checking the proxy and the firewall ERR_TIMED_OUT

根据您的配置,您的反向代理正在侦听端口 443 而不是 8080,这就是为什么当 proxypass 存在时您无法通过 8080 访问应用程序。如果您想通过端口 8080 的 https 访问该应用程序,请尝试以下配置:

<VirtualHost *:8000>  
    ServerName server.com
    SSLEngine on
    SSLCertificateFile /path/to/cerfile.cer
    SSLCertificateKeyFile /path/to/Keyfile.key
    ProxyPass / https://server.com:8000/tree
    ProxyPassReverse / https://server.com/8000/tree                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
</VirtualHost>

这成功了,似乎 Jupyter 具有标准代理配置。 Reference:

ProxyPreserveHost On
ProxyPass /api/kernels/ ws://server:8000/api/kernels/
ProxyPassReverse /api/kernels https://server:8000/api/kernels/
ProxyPass / https://server:8000/
ProxyPassReverse / https://server:8000/