Ubuntu Server with Raspberry Pi Motion Camera

sixtynine

I have an Ubuntu Server that I use as a web server. Everything works great, I have multiple sites set up. My router allows only one device to own the public IP which is my Ubuntu Server. I set up a RaspberryPi with a Camera and Motion. Again, everything works great - I can access the Cam via a browser (IP:8081).

I want to run a website from my Ubuntu and display a live stream from the raspberry. This works great with <img src="IP:8081?action=stream />. However, since the raspberry is internal IP only, I can't see the stream when I'm outside my network.

What do I need to do to have my Ubuntu accessing the raspberry and feedback the stream?

The app is based on codeigniter by the way, motion is set up to work outside locahost as well.

Oli

So you have a server that straddles two networks (WAN and LAN) and you want to expose something from the LAN on the WAN, as part of other content the server hosts.

The easiest way is to tell your HTTP server to proxy the connection. Most servers can do this but I'd do it with Nginx over anything else because it's the best (fastest, smallest, etc, etc). You would use a rule like this:

location /webcam/ {
    proxy_pass http://internal_webcam_IP:8081/?action=stream;
}

For Apache, the same holds true... You just create a quick reverse proxy:

ProxyRequests off
ProxyPass /webcam http://internal_webcam_IP:8081/?action=stream

And then change the HTML image location to:

<img src="/webcam/" />

The networking side of this should be fairly simple but the image hosting on the webcam might not work in an image tag (some use MJPEG, some use javascript) so you might need to embed a page via an iframe, or write some new javascript to update the image (cleaner than the iframe but more work). If you do this, you might need to open up the proxy so it isn't just mirroring the /?action=stream URL.

That complicates things. We're talking about embedded hardware here: famously under-updated and —on the whole— infamously easy to hack. If you do need to open the proxy up to a wider selection of URLs you'll probably also want to add a load of explicit URLs to be blocked to stop external people gaining too much access to your internal network.


The other direction is to use PHP and CodeIgniter to proxy whatever you need.... However a general webdev rule of thumb is that if you can avoid it, don't tie up your server side language handling menial tasks. This is something you can offload to the webserver (or even the networking stack — which I'm not going into because it offers no security at all).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Ubuntu Server with Raspberry Pi Motion Camera

From Dev

Ubuntu Server ARM or Ubuntu Server Raspberry Pi?

From Dev

Connect raspberry pi 4 with ubuntu server to wifi

From Dev

Redistribute modified Ubuntu Server for Raspberry Pi

From Dev

Raspberry Pi camera writing permissions

From Dev

Pi camera preview with GUI - Raspberry Pi

From Dev

Game server on a Raspberry Pi

From Dev

Raspberry Pi Server

From Dev

How to setup of Raspberry Pi 3 onboard WiFi for Ubuntu Server with 'netplan'?

From Dev

Problem with wireless networking for ubuntu server on a Raspberry pi 4

From Dev

Shrinking Raspberry Pi SD .img via Ubuntu Server (cli)

From Dev

How to setup of Raspberry Pi 3 onboard WiFi for Ubuntu Server with 'netplan'?

From Dev

Setup ubuntu server on Raspberry Pi 4 without keyboard

From Dev

wlan0 does not appear in Ubuntu server and raspberry pi 4

From Dev

Ubuntu Server 19.10 i386 for Raspberry Pi

From Dev

Direct remote access (ssh) with Raspberry Pi running Ubuntu server 20.04.1

From Dev

Periodic crash with Ubuntu Server 20.04 on Raspberry Pi 3 B+

From Dev

Can't connect with SSH to Ubuntu server (20.04) on raspberry pi 4

From Dev

OpenCV multiple USB camera on Raspberry Pi 3

From Dev

Integrating Raspberry Pi Camera with Qt application

From Dev

Handle Raspberry Pi camera via Apache

From Dev

Raspberry Pi Camera auto capture python script

From Dev

Integrating Raspberry Pi Camera with Qt application

From Dev

Which camera to connect with Raspberry pi2

From Dev

Get Raspberry Pi Camera Feed into Darknet and Yolo

From Dev

Can a Raspberry Pi run Ubuntu?

From Dev

Can a Raspberry Pi run Ubuntu?

From Dev

Install ubuntu 18.04 on Raspberry Pi

From Dev

Is Python installed: (Raspberry Pi Ubuntu)

Related Related

  1. 1

    Ubuntu Server with Raspberry Pi Motion Camera

  2. 2

    Ubuntu Server ARM or Ubuntu Server Raspberry Pi?

  3. 3

    Connect raspberry pi 4 with ubuntu server to wifi

  4. 4

    Redistribute modified Ubuntu Server for Raspberry Pi

  5. 5

    Raspberry Pi camera writing permissions

  6. 6

    Pi camera preview with GUI - Raspberry Pi

  7. 7

    Game server on a Raspberry Pi

  8. 8

    Raspberry Pi Server

  9. 9

    How to setup of Raspberry Pi 3 onboard WiFi for Ubuntu Server with 'netplan'?

  10. 10

    Problem with wireless networking for ubuntu server on a Raspberry pi 4

  11. 11

    Shrinking Raspberry Pi SD .img via Ubuntu Server (cli)

  12. 12

    How to setup of Raspberry Pi 3 onboard WiFi for Ubuntu Server with 'netplan'?

  13. 13

    Setup ubuntu server on Raspberry Pi 4 without keyboard

  14. 14

    wlan0 does not appear in Ubuntu server and raspberry pi 4

  15. 15

    Ubuntu Server 19.10 i386 for Raspberry Pi

  16. 16

    Direct remote access (ssh) with Raspberry Pi running Ubuntu server 20.04.1

  17. 17

    Periodic crash with Ubuntu Server 20.04 on Raspberry Pi 3 B+

  18. 18

    Can't connect with SSH to Ubuntu server (20.04) on raspberry pi 4

  19. 19

    OpenCV multiple USB camera on Raspberry Pi 3

  20. 20

    Integrating Raspberry Pi Camera with Qt application

  21. 21

    Handle Raspberry Pi camera via Apache

  22. 22

    Raspberry Pi Camera auto capture python script

  23. 23

    Integrating Raspberry Pi Camera with Qt application

  24. 24

    Which camera to connect with Raspberry pi2

  25. 25

    Get Raspberry Pi Camera Feed into Darknet and Yolo

  26. 26

    Can a Raspberry Pi run Ubuntu?

  27. 27

    Can a Raspberry Pi run Ubuntu?

  28. 28

    Install ubuntu 18.04 on Raspberry Pi

  29. 29

    Is Python installed: (Raspberry Pi Ubuntu)

HotTag

Archive