Pixelfed:一个开源免费的照片分享平台-荒岛

Pixelfed:一个开源免费的照片分享平台-荒岛

这个程序最大的特点应该就是支持ActivityPub了,其他还有很多地方需要完善。

想搭建一个玩玩的话,建议VPS内存2G。下面是在Debian10的安装步骤。

首先安装nginx/mariadb/redis/以及一些常用软件和程序需要用到的图像处理工具:

apt -y install nginx python-certbot-nginx mariadb-server redis-server \  curl git unzip imagemagick jpegoptim optipng pngquant

安装PHP7.3(必须7.3):

apt -y install php7.3-common php7.3-cli php7.3-fpm php7.3-mysql \  php7.3-gd php7.3-bcmath php7.3-curl php7.3-intl php7.3-mbstring php7.3-xml

安装composer:

curl -sS https://getcomposer.org/installer | php  mv composer.phar /usr/bin/composer

因为这个程序特别吃内存,这里把PHP-FPM的进程调少点,让其能勉强在1G的VPS内运行:

nano /etc/php/7.3/fpm/pool.d/www.conf

修改的部分:

pm = dynamic  pm.max_children = 120  pm.start_servers = 2  pm.min_spare_servers = 4  pm.max_spare_servers = 6  pm.max_requests = 200 # 解决内存泄漏问题

调整php.ini:

nano /etc/php/7.3/fpm/php.ini

主要修改下面的参数:

post_max_size = 50M  upload_max_filesize = 50M  max_file_uploads = 100  max_execution_time = 600

重启PHP-FPM:

systemctl restart php7.3-fpm.service

初始化MySQL:

mysql_secure_installation

登录到MySQL内:

mysql -u root -p

创建数据库/用户/授权:

CREATE DATABASE pixelfed CHARACTER SET utf8 COLLATE utf8_general_ci;  CREATE USER 'pixelfed'@'127.0.0.1' IDENTIFIED BY '设置你的数据库用户密码';  GRANT ALL PRIVILEGES ON pixelfed.* TO 'pixelfed'@'127.0.0.1';  FLUSH PRIVILEGES;  quit

拉取项目文件/给予正确的权限:

cd /var/www  git clone -b dev https://github.com/pixelfed/pixelfed.git pixelfed && cd pixelfed  chown -R www-data:www-data .  find . -type d -exec chmod 755 {} \;  find . -type f -exec chmod 644 {} \;

安装依赖:

composer install