Skip to content

Docker部署短链接程序LSTU

LSTU = Let’s Shorten That Url

主要参加了这篇 – https://www.moerats.com/archives/956/ 但修改一个bug。

欢迎来 sl.ck.mk 试试短链接。

具体步骤如下

#拉取源码
git clone https://github.com/ldidry/lstu.git
cd lstu
#复制并编辑配置文件,参数修改方法看上面的手动教程,记得将监听地址127.0.0.1改为0.0.0.0,端口不变,并且新增一个dbtype => 'sqlite'。
cp lstu.conf.template lstu.conf
vi lstu.conf
# 我修改这些部分
#构建镜像
docker build --pull -t myorg/lstu .

# 必须加一步
touch lstu.db
chmod 666 lstu.db

# 不然会出现这个错误:
# Can't load application from file "/home/lstu/script/lstu": DBI connect('dbname=lstu.db','',...) failed: unable to open database file at /home/lstu/local/lib/perl5/Mojo/SQLite.pm line 83.

#启动镜像
docker run --restart=always --name lstu_sl -d -p 9050:8080 -v "$(pwd)/lstu.conf:/home/lstu/lstu.conf" -v "$(pwd)/lstu.db:/home/lstu/lstu.db" myorg/lstu

可以通过IP:9050来测试一下。记得暂时打开防火墙端口9050。

然后可以参考这篇(本馆档案)类似的做法来在宝塔当中打开SSL + 反代 + CloudFlare Proxy. 然后把8080的端口再关掉

Leave a Reply

Your email address will not be published.