惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

Rat's Blog - DNS

推荐2个国外免费且稳定的域名DNS解析服务商 - Rat's Blog Linux VPS安装DNSmasq搭建自己的DNS服务器 - Rat's Blog
使用PHPDNS为DNSmasq搭建一个WEB界面 - Rat's Blog
博主: Rat's · 2018-07-10 · via Rat's Blog - DNS

说明:DNSmasq是一个小巧且方便地用于配置DNSDHCP的工具,适用于小型网络,它提供了DNS功能和可选择的DHCP功能。使用DNSmasq可以很方便的搭建递归DNS(公共DNS),诸如类似的119.29.29.29,可以有效的帮助我们防止DNS劫持、屏蔽广告等,博主很久前发过一个DNSmasq搭建教程,查看:Linux安装DNSmasq搭建自己的公共DNS,使用起来还是有点麻烦,现在小Z大佬使用PHPDNSDNSmasq写了个Web界面,让我们使用更加方便了。

截图

请输入图片描述

安装DNSmasq

系统要求:CentOS 67,且需要国内服务器。

1、安装DNSmasq
先使用ifconfig命令查看服务器IP,并记录,比如下图中的192.168.0.4
请输入图片描述
再执行下面的命令安装DNSmasq

#安装epel源
yum -y install epel-release
#安装DNSmasq
wget https://raw.githubusercontent.com/helloxz/dnsmasq/master/dns.sh --no-check-certificate
chmod +x dns.sh
#注意后面填写ifconfig看到的IP
./dns.sh 192.168.0.4

如果是阿里云等服务器,注意防火墙还要放行tcp/udp 53端口。输入netstat -apn|grep 'dnsmasq'可查看DNSmasq是否运行正常。

2、常用命令

启动:service dnsmasq start
停止:service dnsmasq stop
重启:service dnsmasq restart

安装PHPDNS

Github地址:https://github.com/helloxz/phpdns

1、运行原理

#PHPDNS生成DNSmasq格式的配置文件
#服务器crontab定时检测配置文件变化,若有改动则重启DNSmasq使其生效

2、环境要求

PHP 5.6+(需要PDO组件支持)、SQLite 3

3、安装PHPDNS
先访问master.zip下载最新源码,并解压到站点根目录,同时注意站点目录所属用户权限可读可写。

再编辑application/helpers/check_helper.php设置用户名、密码,里面有注释说明。

最后访问您的域名http://domain.com/登录测试。

4、Nginx伪静态设置
如果是Apache已经自带了.htaccess规则,无需额外设置。如果是Nginx请再server段内添加:

location ^~ /application {
        deny all;
}
location ^~ /system {
        deny all;
}
location ^~ /(application|system) {
        deny all;
}
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

添加完成后别忘记重启一次nginx

5、编写Shell脚本
PHPDNS通过shell脚本检测DNSmasq文件变化,使用vi reload.sh命令新建Shell脚本,并写入以下内容,路径请自行修改。

CentOS 7系统:

#!/bin/bash
find /data/wwwroot/xxx.com/application/conf/ -name '*.conf' -mmin -1 -exec /usr/bin/systemctl restart dnsmasq.service {} \;

CentOS 6系统:

#!/bin/bash
find /data/wwwroot/xxx.com/application/conf/ -name '*.conf' -mmin -1 -exec /sbin/service dnsmasq restart {} \;

参数说明:

/data/wwwroot/xxx.com/application/conf/是DNSmasq配置文件目录,改为自己的目录。
/usr/bin/systemctl是CentOS 7 systemctl的目录
/sbin/service是CentOS 6的service目录

别忘记赋予脚本执行权限:chmod +x reload.sh

6、设置crontab定时任务

#安装crontab
yum install crontabs
#新建定时任务
crontab -e
#写入下面的内容,注意路径
*/1 * * * * /root/shell/reload.sh
#重载crontab
service crond reload

/root/shell/reload.sh是上面shell脚本的绝对路径,请注意修改。

7、建立软连接
软连接默认已经生成好了,直接登录PHPDNS后台,将命令复制到Linux终端执行即可。
请输入图片描述

文章来源:小Z博客


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/674/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。