HumHub – 自托管本地私人社交网络

HumHub is a free social network software and framework built to give you the tools to make communication and collaboration easy and successful.

It’s lightweight, powerful and comes with an user-friendly interface. With HumHub you can create your own customized social network, social intranet or huge social enterprise application that really fits your needs.

Boost your business, support your customers, teach your students or organize your football club. It’s on you.

HumHub 的功能类似 Misskey – 又一个去中心化社交平台 和 去中心化社交平台Mastodon(v2.7.3)的部署,都是自托管的社交平台,但是 HumHub 没有争相吹捧的去中心化属性,更像自托管的 Facebook/微博/QQ空间,同时自带的插件功能又很像 WordPress

下文将展示如何在 Debian 11 下部署 HumHub Community 版本,无域名,通过本地 IP 访问,仅作记录

环境

  • Debian
    • LNMP

参考

步骤

准备 LNMP 环境

# MySQL
wget https://repo.mysql.com/mysql-apt-config_0.8.22-1_all.deb
dpkg -i mysql-apt-config_0.8.22-1_all.deb
apt update && apt install mysql-community-server

# PHP 及其组件
apt install php php-cli \
    php-imagick php-curl php-bz2 php-gd php-intl \
    php-mysql php-zip php-apcu-bc php-apcu php-xml php-ldap

# nginx
apt install nginx
rm /etc/nginx/sites-enabled/default
nginx -s reload

配置 PHP 环境

编辑 /etc/php/7.4/fpm/php.ini 文件,修改 upload_max_filesize、post_max_size 和 max_execution_time 字段

upload_max_filesize = 32M
post_max_size = 32M
max_execution_time = 120

重启 PHP-FPM

systemctl restart php7.4-fpm.service

新建数据库

登录 MySQL

mysql -u root -p

新建数据库及其用户

CREATE DATABASE humhub;
CREATE USER 'hh'@'localhost' IDENTIFIED BY 'veryStrongPassword';
GRANT ALL PRIVILEGES ON humhub.* TO 'hh'@'localhost'
exit;

新建 Nginx 配置文件

在 /etc/nginx/sites-available 下新建配置文件 humhub,写入以下内容

server {
    listen 80;
    
    root /var/www/humhub;

    server_name [IP];

    charset utf-8;
    client_max_body_size 256M;

    location / {
        index  index.php index.html ;
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ ^/(protected|framework|themes/\w+/views|\.|uploads/file) {
        deny all;
    }

    location ~ ^/(assets|static|themes|uploads) {
        expires 10d;
        add_header Cache-Control "public, no-transform";
    }

    location ~ \.php {
        fastcgi_split_path_info  ^(.+\.php)(.*)$;

        #let yii catch the calls to unexisting PHP files
        set $fsn /index.php;
        if (-f $document_root$fastcgi_script_name){
                set $fsn $fastcgi_script_name;
        }

        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fsn;
    }
}

新建软链接

ln -s /etc/nginx/sites-available/humhub /etc/nginx/sites-enabled

获取并启用 HumHub

cd /var/www # 直接下载到 Nginx 托管目录
wget https://www.humhub.com/download/package/humhub-1.11.1.tar.gz
tar zxvf humhub-1.11.1.tar.gz
mv humhub-1.11.1 humhub
chown -R www-data:www-data humhub

在 https://www.humhub.com/en/download 获取最新版本号

启用 Nginx 托管

nginx -t # 测试配置文件
nginx -s reload

安装 HumHub

浏览器访问 IP 地址,填写数据库信息时要按照之前步骤内的信息填写,余下安装过程与 WordPress 类似,不再赘述

效果

发表评论

您的电子邮箱地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据