实测Docker搭建短链接服务YOURLS

有什么用
URL缩短服务。可以让你在自己的服务器上运行的URL缩短服务
URL简化, 还可以完全控制自己的数据,包括统计、分析、还可以安装一些插件。
网上现成的其他方案,有的弊端很明显(有的进行隐藏式特殊的跳转)
现成网址缩短 url
短网址
https://t.hk.uy/b5kg
https://netlify.carlzeng.top 暂不支持您输入的域名(后缀)。
使用这个网址来缩短: https://sage-halva-bac054.netlify.app
https://t.hk.uy/b6qy
轻松缩短链接
https://goo.su/BwRaE1T
https://goo.su/prTA5T5
縮短網址產生器
https://tinyurl.com/yurgh2fm
老牌免费短网址工具
http://s8u.cn/HIG7o
优美,但无法接受:先跳转到一个链接以后,在恢复原始网址。
转变思路:
还是用自己的域名做Nname更短,
自己搭建一个短网址服务;短链接服务
实现方法及过程笔记
图文教程
https://iwanlab.com/docker-compose-install-yourls/
https://www.hellosanta.com.tw/knowledge/category-38/post-219
过程+遇到的问题及解决方案
bt 中新建docker-compose模版,
docker-compose -f yours.yml up
然后防火墙开放8200
添加了一条防火墙规则后,无法连接bt面板了;
自己搭建一个短网址服务;短链接服务
https://blog.laoda.de/archives/docker-compose-install-yourls/index.html
https://www.youtube.com/watch?v=pz3XZG_QZ-U
旧版https://www.cnblogs.com/CyLee/p/16152673.html
version: "3.5"
services:
mysql:
image: mysql:5.7.42 # 如果遇到不正确的数据库配置,或无法连接到数据库PDOException: SQLSTATE[HY000] [1045] 用户'yourls'@'yourls_service.yourls_default'的访问被拒绝(使用密码:是) 可以把5.7.22 改为 5.7
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字符(估计是debian下的tab自动输入导致),花了半小时才脑补后排查成功
restart: always
container_name: yourls_mysql #是的这样命名可以避免docker多了以后,名字重复的问题;还一目了然
yourls:
image: yourls
restart: always
ports:
- "8200:80"
environment:
YOURLS_DB_HOST: mysql
YOURLS_DB_USER: admin
YOURLS_DB_PASS: admin
YOURLS_DB_NAME: yourls
YOURLS_USER: admin # 自己起一个名字
YOURLS_PASS: 123admin@@ # 自己换一个登陆密码
YOURLS_SITE: https://c.carlzeng.top:4443 # 换成你自己的域名,然后让Nginx Proxy Manager指向这个地址
YOURLS_HOURS_OFFSET: 8
volumes:
- ./yourls_data/:/var/www/html
container_name: yourls_service
links:
- mysql:mysql
报错误:
yours_mysql | 2023-11-07 13:33:44+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
yours_mysql | 2023-11-07 13:33:44+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
yours_mysql | 2023-11-07 13:33:44+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
yours_mysql | command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.5snRuPe4br
yours_mysql | mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 13 - Permission denied)
yours_mysql | mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
yours_mysql exited with code 1
yours_mysql | 2023-11-07 13:33:57+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
yours_mysql | 2023-11-07 13:33:57+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
yours_mysql | 2023-11-07 13:33:57+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
yours_mysql | command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.atOD1yOw77
yours_mysql | mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 13 - Permission denied)
yours_mysql | mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
成功了,原来是sql的 docker-compose,映射,写错了,
- ./mysql/conf/:/etc/mysql/conf.d
应该是:
- ./mysql/conf/:/etc/mysql/conf
灵感来源
{% tabs 来源%}
Yourls项目地址:https://github.com/YOURLS/YOURLS
旧版本docker说明(实践后无法使用):https://hub.docker.com/_/yourls?tab=description
https://iwanlab.com/docker-compose-install-yourls/
https://blog.laoda.de/archives/yourls-building/
https://www.hellosanta.com.tw/knowledge/category-38/post-219
{% endtabs %}
Docker安装X-UI
docker 搭建 支持单端口多用户、多协议的 xray 面板,究极缝合怪
使用FranzKafkaYu/x-ui版本,仅需要讲上述镜像修改为 enwaiax/x-ui:alpha-zh
由于telegram bot暂时没用,切换回第一个默认https://github.com/vaxilu/x-ui
version: "3.9"
services:
xui:
image: enwaiax/x-ui
container_name: xui
volumes:
- $PWD/db/:/etc/x-ui/
- $PWD/cert/:/root/cert/
restart: unless-stopped
network_mode: host
新建目录,并把上面的配置放到x-ui.yaml中
root@Debian11:/www/server/panel/data/compose/x-ui/template# docker-compose -f x-ui.yaml up
https://www.amadues.link/archives/dockerda-jian-jie-dian-vless-ws-tls-web
docker-compose.yaml的方案follow:https://hostloc.com/thread-1108468-1-1.html
配置的方案follow:https://iwanlab.com/npm-xui/
相关的视频:https://www.youtube.com/watch?v=V3nsDicSMBc
待测试:vless://39fde2d2-c88c-4bea-d491-fb6990d49741@vmess.carlzeng.top:17866?type=ws&security=none&path=%2Fgugu#gugugee
没成功...期待更多的客户端连接测试, 等救援
{% tabs 名称%}
待续。。。
{% endtabs %}