惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Archives - TechRepublic
Security Archives - TechRepublic
O
OpenAI News
W
WeLiveSecurity
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Troy Hunt's Blog
L
LINUX DO - 最新话题
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Palo Alto Networks Blog
Project Zero
Project Zero
Attack and Defense Labs
Attack and Defense Labs
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Tor Project blog
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
Spread Privacy
Spread Privacy
Cisco Talos Blog
Cisco Talos Blog
T
Threatpost
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
P
Privacy & Cybersecurity Law Blog
Know Your Adversary
Know Your Adversary
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
Lohrmann on Cybersecurity
Cloudbric
Cloudbric
I
Intezer
The Hacker News
The Hacker News
L
LINUX DO - 热门话题
AI
AI
B
Blog
S
Securelist
P
Proofpoint News Feed
量子位
Jina AI
Jina AI
V2EX - 技术
V2EX - 技术
T
The Exploit Database - CXSecurity.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CERT Recently Published Vulnerability Notes
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

Rat's Blog - 建站知识

189List:一个全新的天翼云网盘的目录列表程序,CTList升级版 - Rat's Blog TopDocs:一款美观实用的在线文档编辑系统,支持Markdown语法 - Rat's Blog 一个可以绑定多个OneDrive网盘的极简目录列表:OneList - Rat's Blog Navi:一个开源、美观且可以部署在GitHub Pages的网站导航程序 - Rat's Blog Shiori:一个简单、美观且带Web界面的书签管理器 - Rat's Blog 一个简单的PHP Web代理:miniProxy - Rat's Blog 一款开源,美观,带后台管理的网址导航工具:WebStack-Laravel - Rat's Blog 一款基于Web的免费在线矢量图(SVG)编辑工具:Method-Draw - Rat's Blog 使用宝塔面板安装Rocket.Chat多功能团队聊天室 - Rat's Blog
Lstu:一款简单、美观的轻量级网址缩短程序 - Rat's Blog
博主: Rat's · 2019-06-18 · via Rat's Blog - 建站知识

说明:Lstu是一个使用Perl编写的轻量级短网址程序,还提供api、二维码生成、统计面板、网址导入和导出等功能,界面挺简洁的,用起来还行,这里就发个手动和Docker安装。

截图

请输入图片描述
请输入图片描述
请输入图片描述

手动安装

Github地址:https://github.com/ldidry/lstu

教程只适用于DebianUbuntu系统,建议使用Debian 9

#安装依赖
apt update
apt install build-essential libssl-dev zlib1g-dev libpng-dev memcached sqlite git -y
#安装cpanm
curl -L http://cpanmin.us | perl - App::cpanminus
#安装carton
cpanm Carton
#拉取源码
git clone https://github.com/ldidry/lstu.git
cd lstu
#安装lstu,这里默认使用sqlite数据库
carton install --deployment --without=test --without=postgresql --without=mysql
#复制并编辑配置文件
cp lstu.conf.template lstu.conf
nano lstu.conf

这里只说下部分参数:

#端口监听,端口自行修改,如果想使用ip访问,就把127.0.0.1改为0.0.0.0
listen => ['http://127.0.0.1:8080'],
#联系邮箱(必开启)
contact       => 'admin[at]moerats.com',
#主题修改,默认的不太好看,建议修改为如下主题
theme         => 'milligram',
#给统计管理加密码,下面2个参数只需要开启一个
adminpwd      => 'moerats',  //明文密码,直接填字母就行
hashed_adminpwd => '6a3123b',  //hash密码,在ssh客户端使用echo -n moerats | sha256sum即可生成

#其它参数就自己看着修改,比如api限制,黑名单,白名单之类的。

修改好了后,使用ctrl+xy保存退出。

接下来,继续操作,使用命令:

#修改Systemd配置文件,修改lstu路径为自己的,这里默认/root/lstu/,记得后面加/
sed -i -e "s#/var/www/lstu/#/root/lstu/#g" -e "s/www-data/root/g" utilities/lstu.service
#移动配置文件
cp utilities/lstu.service /etc/systemd/system/
#启动
systemctl start lstu
#开机自启
systemctl enable lstu

然后就可以打开ip:8080开始访问了,如果想用域名访问,可以参考后面。

Docker安装

1、安装Docker

#CentOS 6
rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum update -y
yum -y install docker-io
service docker start
chkconfig docker on

#CentOS 7、Debian、Ubuntu
curl -sSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker

2、构建镜像

#拉取源码
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
nano lstu.conf
#构建镜像,如果中途出现kill中断字眼,可能说明你内存太小了,建议添加SWAP,教程:https://www.moerats.com/archives/722/
docker build -t lstu .
#启动镜像
docker run --restart=always --name lstu -d -p 8080:8080 -v "$(pwd)/lstu.conf:/home/lstu/lstu.conf" -v "$(pwd)/lstu.db:/home/lstu/lstu.db" lstu

然后就可以打开ip:8080开始访问了,如果想用域名访问,可以参考后面。

域名反代

安装Caddy

wget -N --no-check-certificate https://raw.githubusercontent.com/iiiiiii1/doubi/master/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh
#备用地址
wget -N --no-check-certificate https://www.moerats.com/usr/shell/Caddy/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh

配置Caddy

#以下全部内容是一个整体,请修改域名、端口后一起复制到SSH运行!
echo "www.moerats.com {
 gzip
 tls admin@moerats.com
 proxy / 127.0.0.1:8080 {
    header_upstream Host {host}
    header_upstream X-Real-IP {remote}
    header_upstream X-Forwarded-For {remote}
    header_upstream X-Forwarded-Port {server_port}
    header_upstream X-Forwarded-Proto {scheme}
  }
}" > /usr/local/caddy/Caddyfile

tls参数会自动帮你签发ssl证书,如果你要使用自己的ssl,改为tls /root/xx.crt /root/xx.key即可。后面为ssl证书路径。

启动Caddy

/etc/init.d/caddy start

就可以打开域名进行访问了。

最后如果你想汉化界面的话,直接修改指定的主题即可,目录themesdocker建议先修改后再构建镜像。


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/956/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。