Implementing Lighttpd for Webhooks on Raspberry Pi as an alternative to Nginx. #2689
clriis
started this conversation in
Show and tell
Replies: 1 comment
-
@clriis |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background.
I run a headless Raspberry Pi 4 ('Bookworm') box with SMB fileserver, VPN gateway, Pi-hole with local DNS and OneDrive sync.
For about two years I have, to my satisfaction, been using Abraunegg/onedrive as my OneDrive sync solution, configured for periodic sync.
The need for instant sync then arose with a project and I took a closer look at utilizing 'webhooks'.
As I already got a Lighttpd web-server running with the Pi-hole package, I explored the option of using this, instead of the Nginx solution, prescribed in the documentation.
It proved to be quite simple, effective and stable and I would like to share the findings.
Prerequisites.
A Raspberry Pi installation with Abraunegg/onedrive and Pi-hole installed (Official Debian Package) or alternatively Lighttpd only.
In your router make a port forwarding of HTTPS (port 443/TCP) to the private IP of the box you are installing to.
If you are using UFW on your box, you should also open port 443/TCP:
# sudo ufw allow HTTPS/TCP
A public IP address and domain name (if you don't have a static public IP address and/or a domain name, you can use one of several free services for a dynamic solution: https://www.makeuseof.com/tag/5-best-dynamic-dns-providers-can-lookup-free-today/).
SSL certificate for the Lighttpd installation. Here you can follow steps 1-6 of Cyberciti's guide: https://www.cyberciti.biz/faq/how-to-configure-lighttpd-web-server-with-free-lets-encrypt-ssl-certificate-on-debian-or-ubuntu-linux/ (I could not get steps 7-9 working on my system and thus implemented an alternative as per below).
Additionally you may find that the issuing end-servers are busy. I solved this by including '--server letsencrypt' in the step 6 command:
# acme.sh --server letsencrypt --issue -w /var/www/html -d www.cyberciti.biz -k 4096
You should also include this switch in the crontab job that is automatically added for renewal of the certificate.
Configuring Lighttpd.
When logged in as root, make a backup of the original configuration file:
# cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
Make the ^/webhooks/onedrive directories in the www root:
# mkdir -p /var/www/html/webhooks/onedrive
Then edit the
/etc/lighttpd/lighttpd.conf
file as follows:Activate modules:
In the top section (server.modules) insert this:
Make SSL communication with OneDrive:
Insert this snippet at the bottom of the file, replacing 'my.public.domain' with you own domain name:
Save the file and exit root.
Restart Lighttpd
# sudo service lighttpd restart
Reconfigure Abraunegg/onedrive.
uncomment the 'webhooks_enabled' line in your onedrive.conf file and change the value to "true"
uncomment the 'webhook_public_url' line and add your domain name
Restart onedrive or reboot
At the end of your Abraunegg/onedrive logfile you should now see something like this:
With the last line:
Initializing subscription for updates ...
Indicating that instant updates has been successfully implemented
Beta Was this translation helpful? Give feedback.
All reactions