快速开始

此部分基于基于 Docker 安装之 docke 与 docker-compose基于 Docker 安装之 Nginx MySQL 和 PHP 环境两篇文章,如果你的 docker-compose 文件与我文中有冲突,那么此篇文章可能并不适合你。或者你可以选择采用我的方案。

安装时为了顺利安装,请先不要开启 https,等待安装完后在开启。

建立 nginx 配置文件

nginx/conf.d文件下新建lsky.conf文件并写入如下内容:

server {
    listen       80;
    server_name  yourdomain; # 这里需要换成你的域名
    root /usr/share/nginx/lsky/public/;
    index index.php;

    access_log /var/log/nginx/lsky_access.log main;

    location ~ \.php$ {
       # try_files $uri $uri/ /index.php?$query_string;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php8.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }

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

}

以上仅为示例,请根据具体情况修改。

上传 lsky 程序

进入lsky-release页面下载程序包,注意不要下载源码包

image-20220327123653334

将压缩包中的文件上传至www/lsky文件夹下,上传完成后进入该目录,并输入命令chmod -R 777 ./*

image-20220327124007651

查看效果

此时重启 dockerdocker-compose restart后访问设置的域名或 ip+端口号即可看到效果。

安装时服务器地址,输入ifconfig查看本机 ip 地址,并填入。

image-20220327000351433

例如我的就是172.28.0.1,数据库可以通过命令或者可视化工具链接后继续新建或者使用启动容器时创建的数据库。

关于 SSL

我的方案是采用又拍云回源服务器方式,因此服务器没必要安装 ssl 证书,只需要在又拍云处申请证书即可。

但是这样会导致样式文件无法正常显示,因此需要调整部分文件。

参考于:【收集贴】安装兰空 v2 常见问题及其解决方法

编辑 .env 文件,追加一行:

ASSET_URL=https://你的域名

但是接口域名还是 http 的,所以在这个文件的 boot 方法里,

lsky-pro/app/Providers/AppServiceProvider.php

public function boot()
 {
     // 是否需要生成 env 文件
     if (! file_exists(base_path('.env'))) {
         file_put_contents(base_path('.env'), file_get_contents(base_path('.env.example')));
         // 生成 key
         Artisan::call('key:generate');
     }

     // 如果已经安装程序,初始化一些配置
     if (file_exists(base_path('installed.lock'))) {
         // 覆盖默认配置
         Config::set('app.name', Utils::config(ConfigKey::AppName));
         Config::set('mail', array_merge(\config('mail'), Utils::config(ConfigKey::Mail)->toArray()));

         View::composer('*', function (\Illuminate\View\View $view) {
             /** @var Group $group */
             $group = Auth::check() ? Auth::user()->group : Group::query()->where('is_guest', true)->first();
             $view->with('_group', $group);
         });
     }
 }
\Illuminate\Support\Facades\URL::forceScheme('https');

对接 PicGo

picgo 我个人使用的插件是lankong,配置参考如下

image-20220326234857512