ini 关于nginx的YOURLS
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini 关于nginx的YOURLS相关的知识,希望对你有一定的参考价值。
server {
listen 80;
listen [::]:80;
server_name hnnh.me www.hnnh.me;
root /var/www/hnnh.me;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /yourls-loader.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
rewrite ^/$ http://hannahwarmbier.com permanent;
}
python 使用Python和Bitly API将来自Yourls的缩短链接迁移到bit.ly
#! /usr/bin/python
#Simple script for importing data from bitly to yourls using bitly and yourls API.
import urllib2, json, urllib
#Add the following data
yourls_host = 'dest-domain.com'
bitly_token = 'TOKEN FROM BITLY'
yourls_signature = 'YOURLS SIGNATURE'
def pushto_yourls_api(data):
url_dest = 'http://'+yourls_host+'/yourls-api.php'
for x in data['data']['link_history']:
link = x['link'].split('/')[3]
long_url = x['long_url']
values = dict(action='shorturl', url = long_url, keyword = link , signature=yourls_signature)
req_data = urllib.urlencode(values)
req = urllib2.Request(url_dest, req_data)
rsp = urllib2.urlopen(req)
content = rsp.read()
print content
origen_url = 'https://api-ssl.bitly.com/v3/user/link_history?format=json&access_token='+bitly_token+'&limit=50'
bitly_result = True
offset = 0
while bitly_result:
url = origen_url + '&offset=' + str(offset)
print url
response = urllib.urlopen(url);
data = json.loads(response.read())
if len(data['data']['link_history']) < 50:
bitly_result = False
offset +=50
pushto_yourls_api(data)
以上是关于ini 关于nginx的YOURLS的主要内容,如果未能解决你的问题,请参考以下文章
使用基于 PHP 的开源软件 YOURLS 搭建短链接地址服务
YOURLS 将“缩短”接口设为私有
python 使用Python和Bitly API将来自Yourls的缩短链接迁移到bit.ly
nginx中的uwsgi .ini param等价物(烧瓶app上有500个错误)
关于nginx服务器上传限制
您的:需要在自定义短网址中扩展字符