diff --git a/docs/guide/bt-deploy.md b/docs/guide/bt-deploy.md index c5e5c3e..0f6bd10 100644 --- a/docs/guide/bt-deploy.md +++ b/docs/guide/bt-deploy.md @@ -24,16 +24,12 @@ ![](../images/bt18.png) -域名那里有域名填写域名,没有的话填写公网 IP。 -根目录选择到 `public` 目录: - -![](../images/bt19.png) - -数据库选择 MySql, 用户名、账号填写上一步创建的。 +一些设置: +设置运行目录: -一些设置: +![](../images/bt19.png) ![](../images/bt21.png) @@ -68,9 +64,156 @@ location ~ \.php$ { ![](../images/bt22.png) - 一点修改: -![](../images/bt24.png) +复制 `.env.example` 文件,修改名称为 `.env`,编辑 `.env` 文件: + ![](../images/bt25.png) + + +修改权限: + +![](../images/bt24.png) + + +需要修改的内容: + +``` +APP_NAME=玉竹 #修改为自己的博客名称,若中间有空格、标点符号,请用英文引号("")包裹 +APP_ENV=production + + +APP_URL=http://127.0.0.1 # 修改为自己的域名或公网IP +ASSET_URL=http://127.0.0.1 # 修改为自己的域名或公网IP + + +MAIL_MAILER=smtp +MAIL_HOST=mailhog +MAIL_PORT=1025 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS="hello@example.com" + +SESSION_DRIVER=redis + +QUEUE_CONNECTION=redis + +CACHE_STORE=redis + +``` + +邮箱配置参考 [使用 QQ 邮箱作为邮箱服务](deploy#使用-qq-邮箱作为邮箱服务)。 + +登入终端,运行命令: + + +![](../images/bt26.png) + + +```shell +cd /www/wwwroot/yuzhu-v1.0.0 # 修改为实际的目录 +``` + +```shell +php artisan key:generate +``` + +遇到权限问题,可使用 `sudo php artisan key:generate` 命令。 + +创建软软连接: + +```shell +php artisan storage:link +``` + + +初始化数据库: + +```shell +php artisan migrate --seed +``` + +![](../images/bt30.png) + + +初始化管理员: + +```shell +php artisan yuzhu:init-admin +``` + +![](../images/bt31.png) + + +删除安装过程中因报错等生成的 Log 文件,以避免出现权限问题。 + +![](../images/bt33.png) + + + +访问: + +![](../images/bt32.png) + + +管理后台在域名后添加 `/admin` 访问即可。 + + +以下操作在终端完成: + +安装 `supervisor`: + +```shell +sudo apt install supervisor +``` + +```shell +sudo vi /etc/supervisor/conf.d/yuzhu-horizon.conf +``` + +复制如下内容,注意修改为自己的目录, + +``` +[program:yuzhu-horizon] +process_name=%(program_name)s +command=php /www/wwwroot/yuzhu-v1.0.0/artisan horizon +autostart=true +autorestart=true +user=www +redirect_stderr=true +stdout_logfile=/www/wwwroot/yuzhu-v1.0.0/storage/logs/horizon.log +stopwaitsecs=3600 +``` + +鼠标右键粘贴,然后输入 `:wq` 保存。 + + +```shell +sudo supervisorctl reread + +sudo supervisorctl update + +sudo supervisorctl start yuzhu-horizon:* +``` + +一些优化: + +```shell +php artisan route:cache +php artisan view:cache +php artisan config:cache +``` + + +设置定时任务: + +![](../images/bt40.png) + +``` +cd /www/wwwroot/yuzhu-v1.0.0 && php artisan schedule:run +``` + +注意设为自己实际的目录 + diff --git a/docs/guide/bt-env.md b/docs/guide/bt-env.md index 6ac0d59..6d28447 100644 --- a/docs/guide/bt-env.md +++ b/docs/guide/bt-env.md @@ -19,6 +19,11 @@ 需要安装的扩展参考 [https://laravel.com/docs/11.x/deployment#server-requirements](https://laravel.com/docs/11.x/deployment#server-requirements) +删除被禁用的函数:`proc_open `,`symlink`,`pcntl_*` 相关的函数 + +![](../images/bt29.png) + + ## 服务器软件选择 `Nginx`: diff --git a/docs/guide/deploy.md b/docs/guide/deploy.md index 2cc4eaa..4cb613d 100644 --- a/docs/guide/deploy.md +++ b/docs/guide/deploy.md @@ -76,11 +76,48 @@ MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="hello@example.com" + +SESSION_DRIVER=redis + +QUEUE_CONNECTION=redis + +CACHE_STORE=redis + +``` + +### 使用 QQ 邮箱作为邮箱服务 + +如果没有其他邮箱服务,可以使用 QQ 邮箱,登录 QQ 邮箱,选择 【设置】 - 【账号】,【POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务】 : + +![](../images/bt35.png) + +![](../images/bt36.png) + +如果已开启,在点击 【管理服务】 - 【生成授权码】: + +![](../images/bt37.png) + + +示例配置: + +``` +MAIL_MAILER=smtp +MAIL_HOST=smtp.qq.com +MAIL_PORT=465 +MAIL_USERNAME="10000@qq.com" +MAIL_PASSWORD=授权码 +MAIL_ENCRYPTION=ssl +MAIL_FROM_ADDRESS="10000@qq.com" ``` + + 验证邮箱是否配置成功: + ```shell php artisan yuzhu:check-email + +php artisan queue:work --queue=high,default ``` ## 生成数据表及数据填充: diff --git a/docs/guide/faq.md b/docs/guide/faq.md index bad8a07..f05b423 100644 --- a/docs/guide/faq.md +++ b/docs/guide/faq.md @@ -12,5 +12,4 @@ ```shell php artisan vendor:publish --force --tag=livewire:assets -``` -这个问题是别人遇到的,解决办法也是别人说的,未曾验证。 \ No newline at end of file +``` \ No newline at end of file diff --git a/docs/images/bt18.png b/docs/images/bt18.png index b9e1feb..2b4a444 100644 Binary files a/docs/images/bt18.png and b/docs/images/bt18.png differ diff --git a/docs/images/bt19.png b/docs/images/bt19.png index 3720d1e..5e1c9ee 100644 Binary files a/docs/images/bt19.png and b/docs/images/bt19.png differ diff --git a/docs/images/bt23.png b/docs/images/bt23.png index c82d9d6..2095ae3 100644 Binary files a/docs/images/bt23.png and b/docs/images/bt23.png differ diff --git a/docs/images/bt24.png b/docs/images/bt24.png index c7b5ff6..f27129b 100644 Binary files a/docs/images/bt24.png and b/docs/images/bt24.png differ diff --git a/docs/images/bt25.png b/docs/images/bt25.png index 17100f5..30adc48 100644 Binary files a/docs/images/bt25.png and b/docs/images/bt25.png differ diff --git a/docs/images/bt26.png b/docs/images/bt26.png new file mode 100644 index 0000000..caf4909 Binary files /dev/null and b/docs/images/bt26.png differ diff --git a/docs/images/bt29.png b/docs/images/bt29.png new file mode 100644 index 0000000..4480cad Binary files /dev/null and b/docs/images/bt29.png differ diff --git a/docs/images/bt30.png b/docs/images/bt30.png new file mode 100644 index 0000000..d6aaa3d Binary files /dev/null and b/docs/images/bt30.png differ diff --git a/docs/images/bt31.png b/docs/images/bt31.png new file mode 100644 index 0000000..2ddf370 Binary files /dev/null and b/docs/images/bt31.png differ diff --git a/docs/images/bt32.png b/docs/images/bt32.png new file mode 100644 index 0000000..a32cedc Binary files /dev/null and b/docs/images/bt32.png differ diff --git a/docs/images/bt33.png b/docs/images/bt33.png new file mode 100644 index 0000000..57628a8 Binary files /dev/null and b/docs/images/bt33.png differ diff --git a/docs/images/bt35.png b/docs/images/bt35.png new file mode 100644 index 0000000..c18af01 Binary files /dev/null and b/docs/images/bt35.png differ diff --git a/docs/images/bt36.png b/docs/images/bt36.png new file mode 100644 index 0000000..ea97b50 Binary files /dev/null and b/docs/images/bt36.png differ diff --git a/docs/images/bt37.png b/docs/images/bt37.png new file mode 100644 index 0000000..cc2502c Binary files /dev/null and b/docs/images/bt37.png differ diff --git a/docs/images/bt40.png b/docs/images/bt40.png new file mode 100644 index 0000000..409f229 Binary files /dev/null and b/docs/images/bt40.png differ