学习笔记

WebStack-Laravel和宝塔安装步骤

fireboy38 · 4月5日 · 2020年 ·

 

1,项目介绍

WebStack-Laravel是一个开源的网址导航网站项目,具备完整的前后台,您可以拿来制作自己的网址导航。非常的简单和实用。基本上每个工程项目下来,都会配合宝塔+WebStack-Laravel给用户搭建一套这个开源项目。鉴于网上都是使用LNMP安装,我在这里详细写一下使用宝塔安装WebStack-Laravel,以及几个注意事项。

WebStack-Laravel github地址:https://github.com/hui-ho/WebStack-Laravel

WebStack-Laravel图鉴如下:

首页

 

2,详细安装步骤

 

2.1 宝塔安装

 

我用的centos7.4,其他linux版本或者windows请到宝塔官网,使用其他命令。宝塔官网地址:https://www.bt.cn/

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

完毕后,进去宝塔后台管理界面,编译安装php7.4 + mysql5.7

 

编译完成后,进入php设置,安装 fileinfo 扩展,在禁用函数里删除putenv,proc_open。

 

然后开始正常添加网站。

 

2.2 composer安装

 

SSH连接到服务器,执行下面命令

php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar  /usr/local/bin/composer
composer config -g repo.packagist composer https://packagist.phpcomposer.com
composer selfupdate
composer update

 

2.3 安装WebStack-Laravel

克隆代码:

git clone https://github.com/hui-ho/WebStack-Laravel.git

安装依赖:

composer install

编辑配置:

cp .env.example .env
...
DB_DATABASE=database
DB_USERNAME=username
DB_PASSWORD=password
...

生成 KEY:

php artisan key:generate  

迁移数据:

php artisan migrate:refresh --seed

数据清除命令:

php artisan webstack:clean

后台地址:http://domain/admin

默认用户:admin

默认密码:admin

2.4 后续相关设置

运行目录,设置到 public

伪静态设置为

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

3,常见问题汇总

 

3.1 运行环境问题

一定要用php7.0以上+MYSQL5.7,mysql5.6导入数据的时候会报错。需要修改一些配置,所以建议直接上mysql5.7


In Connection.php line 664:

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'admin_config' alre
  ady exists (SQL: create table `admin_config` (`id` int unsigned not null auto_incr
  ement primary key, `name` varchar(255) not null, `value` varchar(255) not null, `d
  escription` text null, `created_at` timestamp null, `updated_at` timestamp null) d
  efault character set utf8mb4 collate utf8mb4_unicode_ci)


In PDOStatement.php line 119:

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'admin_config' alre
  ady exists


In PDOStatement.php line 117:

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'admin_config' alre
  ady exists

5.2 PHP扩展和函数的问题

安装fileinfo扩展后,解决下面报错

    The Process class relies on proc_open, which is not available on your PHP installation.
    The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
    Unzip with unzip command failed, falling back to ZipArchive class

启动putenv函数和proc_open函数

0 条回应