应用场景1――基于域名的跳转
公司旧域名www.accp.com ,因业务需求有变更,需要使用新域名www.kgc.com 代替
不能废除旧域名
从旧域名跳转到新域名,且保持其参数不变
实验环境
Linux服务器(192.168.13.144)
测试机win7
1,安装Nginx服务
[root@localhost ~]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm##安装nginx官方源警告:/var/tmp/rpm-tmp.vS0k20: 头V4 RSA/SHA1 Signature, 密钥 ID 7bd9bf62: NOKEY准备中... ################################# [100%]正在升级/安装... 1:nginx-release-centos-7-0.el7.ngx ################################# [100%][root@localhost ~]# yum install nginx -y ##yum安装nginx
2,修改nginx默认配置文件
[root@localhost ~]# vim /etc/nginx/conf.d/default.conf ##修改默认配置文件server { listen 80; server_name www.accp.com; ##修改主机名 #charset koi8-r; access_log /var/log/nginx/www.accp.com-access.log main; ##开启日志服务
3,安装bind解析服务
[root@localhost ~]# yum install bind -y
4,修改主配置文件(named.conf)
[root@localhost ~]# vim /etc/named.conf options { listen-on port 53 { any; }; ##监听所有 listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; recursing-file "/var/named/data/named.recursing"; secroots-file "/var/named/data/named.secroots"; allow-query { any; }; ##允许所有
5,修改区域配置文件(named.rfc1912.zones)
[root@localhost ~]# vim /etc/named.rfc1912.zones ##配置区域配置文件zone "accp.com" IN { type master; file "accp.com.zone"; ##accp区域数据配置文件 allow-update { none; };};
6,修改区域数据配置文件(accp.com.zone)
[root@localhost ~]# cd /var/named/ [root@localhost named]# cp -p named.localhost accp.com.zone ##复制模板[root@localhost named]# vim accp.com.zone ##修改区域配置文件$TTL 1D@ IN SOA @ rname.invalid. ( 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS @ A 127.0.0.1www IN A 192.168.13.144 ##本机地址[root@localhost named]# systemctl start named ##开启dns服务[root@localhost named]# systemctl stop firewalld.service ##关闭防火墙[root@localhost named]# setenforce 0[root@localhost named]# systemctl start nginx ##开启nginx服务[root@localhost named]# netstat -ntap | grep nginx ##查看端口tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4093/nginx: master
新闻热点
疑难解答