-
Notifications
You must be signed in to change notification settings - Fork 0
Home
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.
- Mounting S3 Using s3fs
- Example: fstab.txt
- 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
Securing contents with Signed-url.
- Use s3fs on
assets
,static
&themes
- Secure
/uploads/files/*
on Cloudfront withBehaviors
setting - Redirect access for uploaded files on Humhub into CDN, using Nginx rewrite
- Example: nginx_humhub.conf
- Assume your Humhub using Pretty URLs
- 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)
- JS to add
&filename=
onhref
attribute, for passing original filename into CloudFront functions- Example views_layouts/head.php
- Place the code in your theme,
views/layouts/head.php
- CloudFront functions to add
content-disposition
response header from query string- Example: filename-viewer-response.js
- Associate this function for
Viewer response
on behavior of your distribution
Detail: Less pain on file download
( Earlier experiments: https://gist.github.com/ozero/beb89fc6a462320dc60de3ff64006c9d )