使用 SSL/HTTPS 保护 Raspberry Pi Motion 视频流

问题描述

是否可以使用动作创建安全连接?我已经使用 Apache 在 HTML 页面上嵌入了我的运动流,但它不会显示,因为它是使用 letencrypt 和 certbot 加密的安全页面上的不安全 img。我可以在以下位置查看运动流:

http://www.example.com:<Motion-Port> 但嵌入视频在

https://example.com/camera.html 不会显示

图片代码

<img id="camera" src="http://xx.xxx.xxx.xx:8081">

我试图修改motion.conf文件,但似乎没有任何作用

webcontrol_tls on
stream_tls on
webcontrol_cert /etc/letsencrypt/live/www.example.com/fullchain.pem
webcontrol_key /etc/letsencrypt/live/www.example.com/privkey.pem

Picture of my setup

否则,我很乐意了解另一种将 raspBerry pi 的相机流显示到我的网站的方法

解决方法

我找到了解决方案!

您不需要弄乱motion.conf。

您需要使用 ProxyPass 和 ProxyPassReverse 修改 /etc/apache2/site-enabled

<IfModule mod_ssl.c>
<VirtualHost *:443>
        DocumentRoot "/var/www/html"
        ServerName www.example.com
        ServerAlias example.com


Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/www.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.example.com/privkey.pem

ProxyPass /camera http://xxx.xxx.x.xx:8081/
ProxyPassReverse /camera http://xxx.xxx.x.xx:8081/

</VirtualHost>
</IfModule>

然后在您的 .html 文件中

<img id="camera" src="https://www.example.com/camera">

你可以随意修改相机