Coder Social home page Coder Social logo

1shanyue1 / ddns-aliyun Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dingguotu/ddns-aliyun

0.0 0.0 0.0 44 KB

ddns-aliyun 是基于阿里云解析DNS服务的动态解析脚本,用于检测 IP 变化并更新至阿里云,支持多域名解析。支持 Linux 设备,包括树莓派(Raspberry Pi)。不需要手动添加解析,只要跟着教程来,小白都可以很快上手(软件都不会安装的除外)。

Python 100.00%

ddns-aliyun's Introduction

ddns-aliyun

@author tinko
@version 0.1.0

ddns-aliyun 是基于阿里云解析DNS服务的动态解析脚本,用于检测 IP 变化并更新至阿里云,支持多域名解析。支持 Linux 设备,包括树莓派(Raspberry Pi)。不需要手动添加解析,只要跟着教程来,小白都可以很快上手(软件都不会安装的除外)。


关键词

  1. domain 域名
  2. sub_domain 二级域名,子域名

前置条件

  1. Git
  2. python 3.*
  3. 阿里云账号

使用方法

首先,确保已经安装 git 客户端以及 python 3.*,建议python 3.6+


通过本命令获取 ddns-aliyun

git clone https://github.com/dingguotu/ddns-aliyun.git

接下来到阿里云中创建AccessKey,具体步骤是: 登录阿里云 -> 进入控制台 -> 点击accesskeys accesskeys

-> 创建AccessKey AccessKey


如果域名是在腾讯云或其他非阿里云处购买的,还需要进入相对应的服务商控制台,修改域名的DNS地址为:

ns1.alidns.com
ns2.alidns.com

复制 conf.sample.json 文件,并重命名为 conf.json,根据您的DNSPod设置修改 conf.json 文件,填入以下内容:

{
    "access_key": <access_key>,
    "access_secret": <access_secret>,
    "domains": [
        {
            "name": <first_domain>,
            "sub_domains": [<first_sub_domain_name>, <second_sub_domain_name>,...]
        },
        {
            "name": <second_domain>,
            "sub_domains": [<first_sub_domain_name>, <second_sub_domain_name>,...]
        }
    ]
}

domains部分,想绑定几个就写几个,不需要多写,sub_domains通常写 @* 就够了,二级子域名直接用 * 代替,然后在自己的代理服务器(IIS,nginx,Apache等)上面去进行绑定。domain 和 sub_domain 可以不需要事先手动绑定,本程序会自动识别


最后设置 crontab 定时任务,以便更新DNS记录:

sudo crontab -e
/30 * * * * python /home/pi/ddns/ddns.py

本教程的定时任务是Linux版本,/30 表示每隔30分钟运行一次,可以自行修改,本教程不做限定。/home/pi/ddns/ddns.py 是绝对路径,请根据实际情况进行修改

Windows版请自行学习Windows 任务计划

ddns-aliyun's People

Contributors

dingguotu avatar levin000 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.