Skip to content

Enabling HTTPs

Ardalan Samimi edited this page Jun 30, 2018 · 2 revisions

To serve Raspbot over HTTPs, you need to put your SSL certificate files (fullchain.pem and privkey.pem) in the folder config/.sslcert.

Example

Below follows a guide on how to generate certificates using Certbot and Let's encrypt. For more information see this article.

Generate certificates

First make sure you have Certbot and Let's encrypt installed, and the ports 80 and 443 forwarded to 5000 and 5443 (or, if overridden, the custom ports you've used).

Navigate to the folder raspbot in the project directory and run the following command (NOTE: Remember to change example.com to your URL):

$ certbot certonly --webroot -w ./dist -d example.com --config-dir ~/.certbot/config --logs-dir ~/.certbot/logs --work-dir ~/.certbot/work

Follow the instructions, and wait for it finish.

Add the certificate

If you're using the default configurations, you can now symlink the certificate to the folder config/.sslcert in the folder raspbot/raspbot (NOTE: Remember to change example.com to your URL):

$ cd /path/to/raspbot
$ ln -s ~/.certbot/config/live/pi.saturnfive.se/fullchain.pem raspbot/config/.sslcert/fullchain.pem
$ ln -s ~/.certbot/config/live/pi.saturnfive.se/privkey.pem raspbot/config/.sslcert/privkey.pem

Restart the server.