背景
公司組內(nèi)項(xiàng)目比較多了,各種域名,、網(wǎng)址不利于記憶,,故搭建一套統(tǒng)一的導(dǎo)航網(wǎng)站,網(wǎng)上找了一下,,發(fā)現(xiàn)WebStack非常不錯(cuò),,最終選擇了它,又在官方倉庫的issues里發(fā)現(xiàn)了利用寶塔面板搭建的教程,,所以就直接拿來用了,,詳細(xì)教程如下
一,、安裝寶塔面板
本文忽略,默認(rèn)已安裝
二,、寶塔面板中安裝php7.2
三,、刪除如下PHP禁用函數(shù)
- passthru
- proc_open
四、安裝MySQL5.7版本
五、寶塔新建一個(gè)站點(diǎn),,例如:www.demo.com
六、拉取源碼&部署
1.進(jìn)入站點(diǎn)根目錄
cd /www/wwwroot/www.demo.com
2.clone代碼(這一步下載不動(dòng)可以手動(dòng)下載源碼上傳解壓到網(wǎng)站根目錄)
sudo git clone https://github.com/hui-ho/WebStack-Laravel.git
3.安裝Composer包管理器并且全局處理
sudo curl -sS https:///installer | php
sudo mv composer.phar /usr/local/bin/composer
4.更換源為國內(nèi)源,,國外服務(wù)器可忽略此步驟
sudo composer config -g repo.packagist composer https://packagist.
5.安裝依賴
sudo composer install --ignore-platform-reqs
6.編輯配置
cp .env.example .env
在站點(diǎn)根目對.env文件的編輯以下內(nèi)容
...
DB_DATABASE=數(shù)據(jù)庫名稱
DB_USERNAME=數(shù)據(jù)庫用戶名
DB_PASSWORD=數(shù)據(jù)庫密碼
...
7.生成Key值會(huì)自動(dòng)填入.env文件中
sudo php artisan key:generate
8.遷移數(shù)據(jù)
sudo php artisan migrate:refresh --seed
9.本地測試
sudo php artisan serve
禁用Debugbar 分析器
在站點(diǎn)根目錄下的.env文件中APP_DEBUG的值置成false
修改站點(diǎn)端口
清除數(shù)據(jù)
sudo php artisan webstack:clean
七,、錯(cuò)誤排查
1.數(shù)據(jù)庫編碼錯(cuò)誤,,需要指定為utf8mb4_unicode_ci
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'admin_config' already exists (SQL: create table `admin_config` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `value` varchar(255) not null, `description`
text null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci)
2.升級composer
- 升級命令:sudo composer self-update
Warning: This development build of composer is over 60 days old. It is recommended to update it by running "/usr/local/bin/composer self-update" to get the latest version.
Do not run Composer as root/super user! See https:///root for details
3.composer self-update 出現(xiàn) [ErrorException] zlib_decode(): data error提示
- 解決辦法:編輯php.ini中zlib.output_compression = On、zlib.output_compression_level = 5
4.composer install遇到:Your requirements could not be resolved to an installable set of packages
- 解決辦法:直接忽略版本 composer install --ignore-platform-reqs 或者 composer update --ignore-platform-reqs
5.訪問admin后臺頁面,,提示如下報(bào)錯(cuò)
PHP Fileinfo extension must be installed/enabled to use Intervention Image. (View: /www/wwwroot/live-test.internal.weimobqa.com/vendor/james.xue/login-captcha/resources/views/index.blade.php)
- 解決方案:在寶塔的PHP里面安裝fileinfo插件
6.訪問admin后臺頁面,,提示如下報(bào)錯(cuò)
The stream or file "/www/wwwroot/live-test.internal.weimobqa.com/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
- 解決方案:log日志沒有寫入權(quán)限,,加上寫入權(quán)限
八,、最終效果展示
|