项目: https://github.com/YOURLS/YOURLS

官网: https://yourls.org/

下载: https://github.com/YOURLS/YOURLS/archive/refs/heads/master.zip

搭建环境:

Nginx:1.20.0

MySQL:5.6.50

PHP:8.2.8

1.创建网站以及MySQL

2.下载源码至网站目录并解压

3.更改文件名称

cp user/config-sample.php user/config.php   # 配置文件
cp sample-public-front-page.txt index.php   # 网站首页
cp sample-robots.txt robots.txt

4.下载中文汉化

地址:https://github.com/coppea/yourls-zh_CN

zh_CN.mozh_CN.po 文件下载至 网站目录/user/languages

5.配置文件

配置 网站目录/user/config.php 文件,主要是以下几个参数:

/** MySQL 数据库用户名 */
define( 'YOURLS_DB_USER', 'your db user name' );

/** MySQL 数据库密码 */
define( 'YOURLS_DB_PASS', 'your db password' );

/** MySQL 数据库名 */
define( 'YOURLS_DB_NAME', 'your db name' );

/** YOURLS 安装的网站,网站所解析的域名
define( 'YOURLS_SITE', 'http://your-own-domain-here.com' );


/** YOURLS 中文语言,刚才已经下载完语言包
define( 'YOURLS_LANG', 'zh_CN' );


/** 用于加密的 cookies 随机密码,不需要记住,尽量长而复杂,可在 http://yourls.org/cookie 获取
define( 'YOURLS_COOKIEKEY', 'modify this text with something random' );

/** 登陆的用户名和密码
$yourls_user_passwords = array(
    '用户名' => '密码',
    // 'username2' => 'password2',
    // 你可以使用 'login'=>'password' 这种格式来添加更多行

配置网站伪静态

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

编辑 网站目录/index.php文件,将第17行中 sample-public-front-page.php 修改为 index.php

6.安装

访问域名点击 安装YOURLS,安装完成后点击 YOURLS 管理员页面,使用配置文件中设置的用户名及密码既可登陆后台

7.其他

建议安装插件 Random ShortURLs 以随机生成短链接

最后修改:2023 年 09 月 30 日
如果觉得我的文章对你有用,请随意赞赏