I want to make a security camera using a Raspberry Pi 3 B.

I believe there are more ways of to view the video stream but one way I've found that seems very convenient is through a web server like in this tutorial. From what I understand this isn't very secure and you probably wouldn't want to use it to host a livestream of your front yard. If I did go this route I would get a SSL certificate to make it a little more secure and I've thought of using some PHP code (or another worthy language) to make a password to have to be able to access the pages content. Has anyone thought about this or went through this problem?

I understand the "what's the point of using a webserver if you don't want people to visit" argument, but is there any other alternatives that will still allow me to view the livestream from my phone if im not on my home internet?

  • Avoid using WiFi. There are WiFi jammers. Make sure to hard-wire the camera(s) and protect the wires from being cut. Jun 8, 2022 at 23:04
  • if you use https and authentication (even something simple like digest over https), it's pretty darn secure. the web is the ideal platform for this sort of non-big-tech diy project. You don't define a threat, so it's unclear what you're worried about in terms of "secure"; government, neighbor teens, and burglars all present different issues. What are your concerns about a webserver?
    – dandavis
    Jun 9, 2022 at 2:58
  • I live in a rural area (far from anyone being close to my house) my main concern is just people finding the website and watching it
    – Scup
    Jun 9, 2022 at 11:40

2 Answers 2


A secure way (involving a lot of work) would be like this:

  1. Use a VPN using client certificate and hardware token to connect to a secure network.

  2. Connect the Raspberry Pi to the VPN and configure its firewall to drop any packet not coming from the VPN interface or from the VPN server.

  3. Configure a webserver to only bind to the VPN interface (in the case the firewall fails to drop any package by any mistake).

  4. Configure the webserver to use TLS and employ client certificate authentication.

  5. If serving pictures, store them outside of the webroot and have an application authenticate and authorize the client, and read back the files from the filesystem.

  6. If serving live video, have the application authenticate and authorize the client, and stream data from the camera device.

If you are not familiar with secure programming (not just programming), you should use an off-the-shelf program for that. Every program have bugs, but they are harder to surface on a professionally made application than on a home-made program by someone not experienced.

If you search for "share webcam live stream" you will get a lot of online services that will allow you to do that, and they usually have programs for Linux there.


The question is so broad I get the feeling it will get flagged as needing detail. There are a million ways to solve this.

The simplest in my mind is to leave the rpi server internal to the network and VPN your phone into your home network. Then access the server over the "intranet."

Second would be to use mature security camera software that takes the rpi in as a stream and only expose the mature software. It will take hundreds of hours to reach their level of maturity, more if you don't know what you are doing.

  • This is helpful, thank you. It's broad because I'm not very familiar with RBP (I'd understand a flag) I was hoping there was people out there that have done something similar.
    – Scup
    Jun 8, 2022 at 19:01
  • I will be trying to view my Home cams locally, and hopefully over the phone without going through Google or whatever. One product I found is Zoneminder.com. I have no connection with them, and haven't tried it yet, but their claims are impressive. Not an endorsement.
    – Engineer
    Jun 8, 2022 at 20:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .