搭建BookStack-Wiki平台
BookStack 是一个简单、自托管的、易于使用的免费开源的平台,可用于存储并整理信息。BookStack的界面简单直观,支持WYSIWYG编辑器,将内容划分为书籍、章节和页面三个简单的组别。支持全文搜索内容,跨书籍、章节和页面的链接。
实用链接
- 官网:https://www.bookstackapp.com/
- 文档:https://www.bookstackapp.com/docs/
- GitHub:https://github.com/BookStackApp/BookStack
搭建
环境需求
PHP (\>= 8.0.2)
- 插件: OpenSSL, PDO, MBstring, iconv, Tokenizer, GD, MySQL, SimpleXML & DOM.
MySQL (\>= 5.7 or MariaDB \>= 10.2)
- 用于存储BookStack的内容
Git Version Control
- 用于程序的升级
Composer (\>= v2.0)
- 用于管理和安装PHP的依赖
- 一个 PHP 兼容的 Web 服务器, 比如Nginx
本教程将演示使用 PHP + MySQL + Nginx 手动安装。官方同时提供一键安装脚本和 Docker 搭建,如有需要此类安装方式的朋友可以查阅官方文档。
建立数据库
登录数据库
mysql -uroot -p
创建数据库
CREATE DATABASE bookstack CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
安装BookStack
获取程序源码
git clone https://github.com/BookStackApp/BookStack.git --branch release --single-branch
安装 composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
设置全局访问 composer
sudo mv composer.phar /usr/local/bin/composer
进入文件夹并安装依赖
cd BookStack
composer install --no-dev
修改配置文件
cp .env.example .env
vim .env
以下配置文件仅供参考,具体可配置参数请参考官方文档:
# This file, when named as ".env" in the root of your BookStack install
# folder, is used for the core configuration of the application.
# By default this file contains the most common required options but
# a full list of options can be found in the '.env.example.complete' file.
# NOTE: If any of your values contain a space or a hash you will need to
# wrap the entire value in quotes. (eg. MAIL_FROM_NAME="BookStack Mailer")
# Application key
# Used for encryption where needed.
# Run `php artisan key:generate` to generate a valid key.
APP_KEY=
# Application URL
# This must be the root URL that you want to host BookStack on.
# All URLs in BookStack will be generated using this value
# to ensure URLs generated are consistent and secure.
# If you change this in the future you may need to run a command
# to update stored URLs in the database. Command example:
# php artisan bookstack:update-url https://old.example.com https://new.example.com
APP_URL=
# Application TimeZone
APP_TIMEZONE=
# Database details
DB_HOST=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
# SMTP mail options
# These settings can be checked using the "Send a Test Email"
# feature found in the "Settings > Maintenance" area of the system.
# For more detailed documentation on mail options, refer to:
# https://www.bookstackapp.com/docs/admin/email-webhooks/#email-configuration
# SMTP server port
# Using port 465 will force connections to be via TLS
MAIL_DRIVER=
# SMTP server host address
MAIL_HOST=
# SMTP server port
# Using port 465 will force connections to be via TLS
MAIL_PORT=
# Connection encryption to use
# Valid values are: tls, null
# Using 'tls' will require either TLS or STARTTLS to be used.
# When using 'null' STARTTLS will still be attempted if announced
# as supported by your SMTP server.
# Using port 465 above will force connections to be via TLS.
MAIL_ENCRYPTION=
# Authentication details for your SMTP service
MAIL_USERNAME=
MAIL_PASSWORD=
# The "from" email address for outgoing email
MAIL_FROM=
# The "from" name used for outgoing email
MAIL_FROM_NAME=
# s3 Storage Type
#STORAGE_TYPE=s3
#STORAGE_S3_KEY=
#STORAGE_S3_SECRET=
#STORAGE_S3_BUCKET=
#STORAGE_S3_ENDPOINT=
# File Upload Limit
# Maximum file size, in megabytes, that can be uploaded to the system.
FILE_UPLOAD_SIZE_LIMIT=
# Set the revision limit to 20
# Defaults to '100'
REVISION_LIMIT=
# Set a recycle bin item lifetime of 30 days
RECYCLE_BIN_LIFETIME=
# Debug Mode
#APP_DEBUG=true
注:一些用不到的参数可注释不填
更新数据库:
php artisan migrate
配置Nginx
server {
listen 80;
listen [::]:80;
server_name bookstack.dev;
root /var/www/bookstack/public; # 一定要写到public路径
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
评论已关闭。 了解详情