Local web server for backyard camera
What is in this article
- This is similar to allowing access to Motion, except that motion creates files which are served by a web server instead of motion serving them itself.
- The main advantage over allowing access to Motion itself is that webservers are more ‘battle-tested’ with respect to remote access flaws.
- See below for notes on security, port forwarding, and/or PageKite.
- We don’t discuss the webserver configuration here as there are many guides already available for that.
- For the
copymotionscript below it is assumed that the directory from which the web server is configured to serve the files is
/var/www/html/motionand that is writable by the
motionuser. You should adapt the script as appropriate if you configure the web server with a different directory.
- We further assume that the
rclone‘remote’ is called
localwebfor this server.
copymotion script for copying to a local web server directory when using the above autocopy configuration on
Copy this script to
#!/bin/sh ( rclone copy /var/lib/motion/data localweb:/var/www/html/motion & )
NB This script assumes you have configured the destination for videos and photos to be
/var/lib/motion (which is the default). This is because the rclone config lives in
/var/lib/motion/.config and we do not want to copy it to the web server.