BookStack Menual installation(Nginx)

LNMP 先建立完成後安裝git/composer/php-tidy:

apt install git composer php-tidy

先移動到要存放的位置:

cd /var/www

安裝完成之後git clone 官方原版或者節神帶中文版本:

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

git clone https://github.com/jasoncheng7115/BookStack.git --branch release --single-branch

進入到檔案內部先預先改安裝內容:

nano  BookStack/config/database.php

修改這個欄位為你要的資料庫連接方式:

'mysql' => [
            'driver'    => 'mysql',
            'host'      => '10.0.1.4',
            '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,
        ],

複製.env:

cp .env.example .env

預先編輯.env:

nano .env

修改此區間內容:

# Database details
DB_HOST=10.0.1.4
DB_DATABASE=bookstack
DB_USERNAME=bookstack
DB_PASSWORD=yourpasaswd

給予權限:

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

執行:

composer install
php artisan key:generate

若無資料 使用此方法重試:

sudo php artisan key:generate
sudo php artisan migrate

完成之後請先至mariaDB上面建立對應所屬使用者與資料庫(可以使用phpmyadmin)

建立Nginx config:

nano /etc/nginx/sites-enabled/yourdomain

範例參考:

server {
        listen 80;

        root /var/www/BookStack/public;

        index index.php;

        server_name yourdomainname;

        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.1-fpm.sock;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
}

測試config並重啟Nginx 服務:

nginx -t
service nginx restart

 

 

阅读剩余
THE END