Docker:搭建短网址服务YOURLS

来源

https://blog.laoda.de/archives/docker-compose-install-yourls

https://occdn.limour.top/1898.html

第一步 增加swap空间

第二步 部署YOURLS容器

  • mkdir yourls
  • cd yourls
  • nano docker-compose.yml
  • sudo docker-compose up -d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
version: "3.5"
services:

mysql:
image: mysql:5.7.22
environment:
- MYSQL_ROOT_PASSWORD=my-secret-pw
- MYSQL_DATABASE=yourls
- MYSQL_USER=yourls
- MYSQL_PASSWORD=yourls
volumes:
- ./mysql/db/:/var/lib/mysql
- ./mysql/conf/:/etc/mysql/conf.d
restart: always
container_name: mysql

yourls:
image: yourls
restart: always
ports:
- "8200:80"
environment:
YOURLS_DB_HOST: mysql
YOURLS_DB_USER: yourls
YOURLS_DB_PASS: yourls
YOURLS_DB_NAME: yourls
YOURLS_USER: admin # 自己起一个名字
YOURLS_PASS: admin # 自己换一个登陆密码
YOURLS_SITE: https://j11.fun # 换成你自己的域名
YOURLS_HOURS_OFFSET: 8
volumes:
- ./yourls_data/:/var/www/html
container_name: yourls_service
links:
- mysql:mysql

第三步 NPM面板反代YOURLS

第四步 更改语言包

  • sudo apt install zip -y
  • wget https://github.com/ZvonimirSun/YOURLS-zh\_CN/archive/refs/tags/v1.7.3.zip
  • unzip v1.7.3.zip
  • sudo mv YOURLS-zh_CN-1.7.3/* ./yourls_data/user/languages/
  • cd ./yourls_data/user/languages/
  • sudo chown -R www-data:www-data zh_CN.mo
  • sudo chown -R www-data:www-data zh_CN.po
  • sudo nano ../config.php
  • define( ‘YOURLS_LANG’, getenv(‘YOURLS_LANG’) ?: ‘zh_CN’ );

示例

https://j11.fun/blog+


Docker:搭建短网址服务YOURLS
https://occdn.limour.top/1901.html
Author
Limour
Posted on
June 29, 2022
Licensed under