基于Docker安装之lsky-pro_v2图床
快速开始
此部分基于基于 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页面下载程序包,注意不要下载源码包。
将压缩包中的文件上传至www/lsky
文件夹下,上传完成后进入该目录,并输入命令chmod -R 777 ./*
。
查看效果
此时重启 dockerdocker-compose restart
后访问设置的域名或 ip+端口号即可看到效果。
安装时服务器地址,输入ifconfig
查看本机 ip 地址,并填入。
例如我的就是172.28.0.1
,数据库可以通过命令或者可视化工具链接后继续新建或者使用启动容器时创建的数据库。
关于 SSL
我的方案是采用又拍云回源服务器方式,因此服务器没必要安装 ssl 证书,只需要在又拍云处申请证书即可。
但是这样会导致样式文件无法正常显示,因此需要调整部分文件。
编辑 .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,配置参考如下
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 小康博客!
评论
ArtalkDisqusjs