• 欢迎访问db1024网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏db1024吧

Lstu:一款简单、美观的轻量级网址缩短程序

建站知识 Liam 1年前 (2019-06-18) 933次浏览 21个评论 扫描二维码
文章目录[隐藏]

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

截图

Lstu:一款简单、美观的轻量级网址缩短程序
Lstu:一款简单、美观的轻量级网址缩短程序
Lstu:一款简单、美观的轻量级网址缩短程序

手动安装

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/ToyoDAdoubiBackup/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 [email protected]  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-Proto {scheme}   } }" > /usr/local/caddy/Caddyfile 

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

启动Caddy

/etc/init.d/caddy start 

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

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


db1024 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Lstu:一款简单、美观的轻量级网址缩短程序
喜欢 (0)
关于作者:
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(21)个小伙伴在吐槽
  1. Hi there mates, good paragraph and good urging commented at this place, I am truly enjoying by these.
    website hosting companies2020-09-01 00:57 回复 Linux | Firefox浏览器 60.0.2
  2. When I originally commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get three e-mails with the same comment. Is there any way you can remove me from that service? Thanks a lot!
    web hosting company2020-09-01 00:16 回复 Windows 8.1 | Firefox浏览器 60.0
  3. Your style is unique in comparison to other people I've read stuff from. Thank you for posting when you have the opportunity, Guess I will just book mark this web site.
    black mass2020-08-31 10:08 回复 Linux | Firefox浏览器 56.0
  4. I am curious to find out what blog platform you have been using? I'm experiencing some minor security issues with my latest blog and I would like to find something more secure. Do you have any recommendations?
    cheap flights2020-08-28 13:08 回复 Mac OS X | Safari浏览器 601.1.27
  5. Appreciate this post. Will try it out. cheap flights y2yxvvfw
    cheap flights2020-08-25 22:09 回复 Windows 7 | 360浏览器 SE
  6. An outstanding share! I have just forwarded this onto a colleague who was conducting a little homework on this. And he actually bought me breakfast due to the fact that I discovered it for him... lol. So let me reword this.... Thank YOU for the meal!! But yeah, thanks for spending some time to talk about this topic here on your internet site. cheap flights 3gqLYTc
    cheap flights2020-08-25 17:39 回复 Linux | Firefox浏览器 52.9
  7. A fascinating discussion is worth comment. There's no doubt that that you need to publish more about this subject, it might not be a taboo subject but typically people do not talk about such subjects. To the next! Kind regards!!
    cheap flights2020-08-24 15:55 回复 Windows 8.1 | Firefox浏览器 60.0
  8. Please let me know if you're looking for a writer for your weblog. You have some really good posts and I think I would be a good asset. If you ever want to take some of the load off, I'd really like to write some articles for your blog in exchange for a link back to mine. Please send me an email if interested. Regards!
    web hosting company2020-08-14 13:16 回复 Linux | Firefox浏览器 59.0
  9. I every time emailed this website post page to all my friends, because if like to read it afterward my links will too.
    best website hosting2020-08-10 17:27 回复 Windows 7 | Internet Explorer 9.0
  10. Generally I do not learn article on blogs, but I wish to say that this write-up very pressured me to check out and do it! Your writing style has been amazed me. Thanks, quite great post.
    best web hosting 20202020-08-07 00:00 回复 Linux | Firefox浏览器 61.0
  11. My brother suggested I may like this website. He was once entirely right. This put up truly made my day. You can not consider just how a lot time I had spent for this information! Thanks!
    website hosting services2020-08-06 00:27 回复 Linux | Firefox浏览器 2.0.0.2
  12. I'd like to thank you for the efforts you have put in penning this website. I'm hoping to see the same high-grade content by you later on as well. In fact, your creative writing abilities has encouraged me to get my own blog now ;)
    skyscanner uk2020-07-31 08:25 回复 Mac OS X | Chrome 51.0.2704.84
  13. It's an awesome piece of writing designed for all the internet people; they will take advantage from it I am sure. adreamoftrains web hosting service
    adreamoftrains best web hosting2020-07-30 19:15 回复 Linux | Chrome 66.0.3359.158
  14. Keep this going please, great job!
    cheap flights to vegas2020-07-27 20:21 回复 Linux | Chrome 64.0.3282.186
  15. Excellent post! We will be linking to this great article on our website. Keep up the good writing.
    best website hosting2020-07-27 05:35 回复 Linux | Chrome 51.0.2712.8
  16. I feel that is one of the so much significant info for me. And i'm satisfied reading your article. But want to commentary on some general things, The website style is great, the articles is truly nice : D. Just right job, cheers
    best web hosting company2020-07-26 08:38 回复 Linux | Chrome 65.0.3325.181
  17. You really make it seem so easy with your presentation but I find this matter to be really something that I think I would never understand. It seems too complex and extremely broad for me. I'm looking forward for your next post, I'll try to get the hang of it!
    web host2020-07-18 08:24 回复 Windows 8.1 | Chrome 67.0.3381.1
  18. I was curious if you ever thought of changing the page layout of your blog? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or 2 images. Maybe you could space it out better?
    web hosting service2020-07-16 17:48 回复 Windows Vista | Firefox浏览器 3.1b3
  19. Hola! I've been reading your weblog for a long time now and finally got the bravery to go ahead and give you a shout out from Austin Tx! Just wanted to mention keep up the great job!
    cbd oil that works 20202020-06-29 08:19 回复 Linux | Chrome 66.0.3359.170
  20. I think this is one of the most vital information for me. And i am glad reading your article. But should remark on some general things, The site style is great, the articles is really nice : D. Good job, cheers
    cbd oil that works 20202020-06-27 19:51 回复 Linux | Chrome 68.0.3398.0
  21. WOW just what I was looking for. Came here by searching for BT
    g rsacwgxy2020-06-23 20:49 回复 未知操作系统 | Chrome 65.0.3325.209