Skip to content
ozero dien edited this page Nov 24, 2021 · 18 revisions

Equip unlimited storage & bandwidth with Humhub instance, using AWS S3 & Cloudfront (Signed-url) , fuse & s3fs, Nginx.

...without modifying Humhub (almost) ! Here's the steps & files that you'll need.

Overview:

Get unlimited storage:

  • Mounting S3 Using s3fs
  • Use s3fs on /path/to/humhub/uploads
  • Your access goes through Symlink /path/to/humhub/uploads -> mountpoint /path/to/mountpoint/uploads -(s3fs)-> s3

Detail: Get unlimited storage

Get unlimited bandwidth (with security):

Securing contents with Signed-url.

  • Use s3fs on assets, static & themes
  • Secure /uploads/files/* on Cloudfront with Behaviors setting
  • Redirect access for uploaded files on Humhub into CDN, using Nginx rewrite
  • Write redirector that checks your $_SESSSION & privileges, then redirects into CDN with signed-url
    • Example: r.php
    • Place r.php on same directory with /path/to/humhub/index.php

Detail: Get unlimited bandwidth (with security)

Less pain on file download

  • JS to add &filename= on href attribute, for passing original filename into CloudFront functions
  • CloudFront functions to add content-disposition response header from query string

Detail: Less pain on file download

( Earlier experiments: https://gist.github.com/ozero/beb89fc6a462320dc60de3ff64006c9d )