一、安装DNS服务
1.安装环境
-
192.168.2.175
-
关闭SELinux和防火墙
-
关闭libvirtd服务
2.步骤
安装unbound
yum install unbound -y
修改配置
vi /etc/unbound/unbound.conf
interface: 0.0.0.0
access-control: 0.0.0.0/0 allow
username: ""
logfile: "/var/log/unbound.log"
添加映射
vi /etc/unbound/local.d/dq.conf
local-data: "xian.hbisdt.com IN A 192.168.2.67"
加载配置
sudo unbound-control reload
二、安装反向代理服务器
1.安装nginx
cd /usr/soft
mkdir nginx
wget http://nginx.org/download/nginx-1.13.7.tar.gz
tar -xvf nginx-1.13.7.tar.gz
./configure --prefix=/usr/soft/nginx
make
make install
2.修改配置
vi /usr/soft/nginx/conf/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name xian.hbisdt.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://192.168.2.67:8081;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
三、添加新映射
1.修改nginx,添加新的server配置
服务器地址:192.168.2.63 root 123456
vi /usr/soft/nginx/conf/nginx.conf
server {
listen 80;
server_name xian.dstore.com; //此处为域名
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://192.168.2.74:8481; //此处为转发地址
}
}
加载nginx配置
/usr/soft/nginx/sbin/nginx -s reload
2.添加dns映射
服务器地址:192.168.2.175 root 123456
vi /etc/unbound/local.d/dq.conf
local-data: "xian.dstore.com IN A 192.168.2.63"
加载配置即可
sudo unbound-control reload
3.Linux 修改服务器DNS配置
vi /etc/resolv.conf
nameserver 192.168.2.175