Install BookStack step by step

OS: Ubuntu 18.04 LTS

此步驟僅安裝bookstack and nginx

1.install package

apt install -y git nginx composer php-tidy curl php7.2-fpm php7.2-curl php7.2-mbstring php7.2-ldap php7.2-tidy php7.2-xml php7.2-zip php7.2-gd php7.2-mysql

2.Download Bookstack

cd /var/www/
git clone https://github.com/BookStackApp/BookStack.git --branch release --single-branch

3.Change database HOST and Password

nano /var/www/BookStack/config/database.php
'mysql' => [
            'driver'    => 'mysql',
            'host'      => '10.0.9.9',
            'database'  => env('DB_DATABASE', 'bookstack'),
            'username'  => env('DB_USERNAME', 'bookstack'),
            'password'  => env('DB_PASSWORD', 'yourpasswd'),
            'port'      => $mysql_port,
            'charset'   => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

4.修改.env

cp /var/www/BookStack/.env.example /var/www/BookStack/.env
nano /var/www/BookStack/.env
# Database details
DB_HOST=10.0.9.9
DB_DATABASE=bookstack
DB_USERNAME=bookstack
DB_PASSWORD=yourpasaswd

5.修改權限

cd /var/www/BookStack
chown -R www-data: /var/www/BookStack
chmod 777 -R storage bootstrap/cache public/uploads

6.執行

composer install
php artisan key:generate

7.建立nginx conf

nano /etc/nginx/sites-available/bookstack

8.修改config

server {
        listen 80;

        root /var/www/BookStack/public;

        index index.php;

        server_name docs.example.com;

        location / {
                try_files $uri $uri/ /index.php$query_string;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                include fastcgi_params;
                fastcgi_index index.php;
                fastcgi_pass unix:/run/php/php7.7-fpm.sock;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
}

docs.example.com 請修改成自己的domain

最好先作ls -al /run/php/,確定php-fpm的版本

9.將conf連結到/etc/nginx/site-enabled下

cd /etc/nginx/sites-enabled/
ln -s ../sites-available/bookstack bookstack
service nginx restart

Revision #4
Created 3 weeks ago by ishtar.lin
Updated 2 weeks ago by ishtar.lin