Enabling HTTPS on your Debian or Raspi server

HTTPS on Raspi Server

Because of the underlying framework (Django, Channels, and Daphne), the CAM-AI server cannot supply HTTPS. For opening the webserver to the internet (beyond your home network and safe behind the firewall of your router), it is necessary to add another layer to enable HTTPS web service on the Raspi server. We will use nginx working as a reverse proxy for this purpose. We assume that the server was installed following these instructions and was put into autostart mode following these instructions. We further assume that you have forwarded an external internet domain (ports 80, 8000, and 10443) pointing to your router to the raspi with the CAM-AI system. In this tutorial, we will use the example mydomain.org. Please replace it with your actual domain. Now you’re ready to get started! Log into your Raspi as user cam_ai:

First, install nginx:

Then we create a nginx configuration file for our webserver:

We fill the file with this content:

Remember to replace all occurrences of mydomain.org with your real domain. Save and close Nano.

Find the line that starts with “mydomain”, and replace it with this one:

Find the line that starts with “httpsport”, and replace it with this one:

Save and close Nano. Last we install letsencrypt to generate the needed SSL certificates:

Then we start it and generate the certificates: (Ensure that port 80 is open on your Raspberry Pi.)

Open the certbot configuration file:

Again: Remember to replace all occurrences of mydomain.org with your real domain. Find the line:

Replace it with:

Save and close Nano. Open the service description file:

Find the line:

Replace it with:

Save and close Nano. Reboot the server and you are done.

Discuss this topic in our Forum

Scroll to Top