Lsky Pro 是一款开源的图床程序,支持多种存储方式,提供了良好的用户界面和丰富的功能。本文将详细介绍如何使用 Docker Compose 来部署 Lsky Pro,这种方式相比传统安装更加简单和可维护。
https://docs.lsky.pro/guide/install
https://www.cpolar.com/blog/casaos-uses-docker-to-build-lsky-pro-locally
https://hub.docker.com/r/dko0/lsky-pro
https://blog.laoda.de/archives/docker-compose-install-lskypro
https://github.com/lsky-org/lsky-pro/issues/256
mkdir lsky-pro
cd lsky-pro
创建 docker-compose.yml
文件并添加以下内容:
services:
lsky-pro:
container_name: lsky-pro
image: dko0/lsky-pro
restart: always
volumes:
- ${PWD}/data:/var/www/html
ports:
- 127.0.0.1:7791:80
environment:
- MYSQL_HOST=mysql
- MYSQL_DATABASE=lsky-pro
depends_on:
- mysql
mysql:
image: mysql:8.0
container_name: lsky-pro-mysql
restart: always
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-authentication-plugin=mysql_native_password
environment:
MYSQL_DATABASE: lsky-pro
MYSQL_ROOT_PASSWORD: your_password
TZ: 'Asia/Shanghai'
volumes:
- ${PWD}/mysql:/var/lib/mysql
在 Nginx 配置目录中创建新的站点配置文件,添加以下内容:
server {
listen 80;
listen [::]:80;
server_name your_domain.com;
location / {
proxy_pass http://127.0.0.1:7791;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto "https";
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
}
}
docker compose up -d
http://your_domain.com
重要数据存储在以下位置:
- MySQL 数据:./mysql
- 上传的图片:./data/storage/app/uploads
建议定期备份这些目录。
docker compose pull
docker compose up -d
docker compose logs -f lsky-pro
数据库连接失败
上传失败
data
目录权限访问 502
通过 Docker Compose 部署 Lsky Pro 不仅简化了安装过程,还提供了良好的可维护性和扩展性。建议在生产环境中启用 HTTPS 并定期维护系统安全。
还没有人评论,抢个沙发吧...