搭建自有短网址生成站教程

一、准备

1、安装宝塔面板
2、新建站点+数据库
3、下载网站文件 https://github.com/YOURLS/YOURLS/archive/master.zip ,解压并将所得文件夹内文件移动到根目录
4、文件权限设置为www、755
5、文件改名:(可以使用指令)
将user下config-sample.php文件重命名为config.php
将根目录下sample-public-front-page.txt文件重命名为index.php
将根目录下sample-robots.txt文件重命名为robots.txt

cd /www/wwwroot/站点/
cp user/config-sample.php user/config.php
cp sample-public-front-page.txt index.php
cp sample-robots.txt robots.txt

6、配置user/config.php文件
7、配置index.php文件

将 $page = YOURLS_SITE . '/sample-public-front-page.php' ;
改成 $page = YOURLS_SITE . '/index.php' ;

8、宝塔中配置网站伪静态

location / {
    try_files $uri $uri/ /yourls-loader.php?$args;
}

二、安装

1、访问域名
2、点击<install yourls>
3、重新访问域名即可


三、设置中文

1、访问https://github.com/guox/yourls-zh_CN/archive/master.zip 下载汉化包,并解压到user/languages
2、配置user/config.php


四、安装插件及主题

1、插件管理,激活Random SHortURLs插件
2、目前有三款主体:sleekyinfinity-squaredair66,以下以sleeky为例
3、下载sleeky
A.将sleeky-backend目录的内容移至根目录
B.打开frontend/config.php文件并更改其值以适合(如有reCAPTCHA记得设置)。 现在已经安装好前端(reCAPTCHA申请地址:https://www.google.com/recaptcha)
C.将sleek-backend文件夹移到user/plugins(插件也是如此安装)
D.网页后台插件管理中激活Sleeky Backend插件,后端安装完成。

  • 2021 年 10 月 31 日