2

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

 2 years ago
source link: https://azhuge233.com/humhub-%E8%87%AA%E6%89%98%E7%AE%A1%E6%9C%AC%E5%9C%B0%E7%A7%81%E4%BA%BA%E7%A4%BE%E4%BA%A4%E7%BD%91%E7%BB%9C/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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

Snipaste_2022-05-05_14-27-01-720x364.png

文章目录 显示

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 环境

# 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
# 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
upload_max_filesize = 32M
post_max_size = 32M
max_execution_time = 120
Snipaste_2022-05-05_14-14-56.png
Snipaste_2022-05-05_14-15-07.png
Snipaste_2022-05-05_14-15-20.png

重启 PHP-FPM

systemctl restart php7.4-fpm.service
systemctl restart php7.4-fpm.service

新建数据库

登录 MySQL

mysql -u root -p
mysql -u root -p

新建数据库及其用户

CREATE DATABASE humhub;
CREATE USER 'hh'@'localhost' IDENTIFIED BY 'veryStrongPassword';
GRANT ALL PRIVILEGES ON humhub.* TO 'hh'@'localhost'
exit;
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;
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
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
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
nginx -t # 测试配置文件
nginx -s reload

安装 HumHub

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

Snipaste_2022-05-05_14-13-48-768x462.png
Snipaste_2022-05-05_14-13-11-768x529.png
Snipaste_2022-05-05_14-23-55-768x462.png
Snipaste_2022-05-05_14-25-46-768x462.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK