YOURLS这次我们来介绍下Polr,相比于YOURLS这种要么自己用,要么自己二次开发来对外提供服务,Polr可能更加倾向于开箱即用,没有太多的设定和插件,也没用什么需要自己修改代码的
Polr是一个开源的短链接软件,也就是不存在收费的问题,而且功能也足够强大
典型的LNMP 安装环境:
php环境要求
安装Polr服务
#进入vhost设置的网站根目录
cd?/data/wwww
git?clone?https://github.com/cydrobolt/polr.git?--depth=1?.
#如果开着selinux请运行这个,当然我其实建议关闭selinux,不然太麻烦
chcon?-R?-t?httpd_sys_rw_content_t?storage?.env
#获取composer,你装过了的话请跳过
#这儿的php路径请自行确认
curl?-sS?https://getcomposer.org/installer?|?/usr/local/php/bin/php
mv?composer.phar?/usr/local/bin/composer
#使用composer安装依赖
rm?composer.lock
composer?install?--no-dev?-o
#修改文件所有者
chown?-R?www:www?*?.*
#复制一份默认配置,不用改,后面安装的时候会自动修改
cp?.env.setup?.env
Nginx配置
server?{?
?listen?80;
?server_name?gto.ee?www.gto.ee;
?access_log?off;
?index?index.html?index.htm?index.php;
?root?/data/wwwroot/gto.ee/public;
?
?location?/?{
?try_files?$uri?$uri/?/index.php$is_args$args;
?}
location?~?[^/]\.php(/|$)?{
?#fastcgi_pass?remote_php_ip:9000;
?fastcgi_pass?unix:/dev/shm/php-cgi.sock;
?fastcgi_index?index.php;
?include?fastcgi.conf;
?}
location?~?.*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$?{
?expires?30d;
?access_log?off;
?}
?location?~?.*\.(js|css)?$?{
?expires?7d;
?access_log?off;
?}
?location?~?/\.ht?{
?deny?all;
?}
}
参考文章:
自建短链服务系列——Polr(简约而不简单) www.senra.me/self-hosted-url-shortener-series-polr-simple-but-powerful/
一个功能强大的网址缩短程序:Polr搭建教程 https://www.moerats.com/archives/536/
转载本站文章《短链服务器搭建:短网址程序Polr配置及使用》, 请注明出处:https://www.zhoulujun.cn/html/php/phpcms/2019_0828_8395.html
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。