Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS 7 install the master-slave DNS service and configure the Apache server

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Install the main DNS server 1 and configure the main DNS [root@centos01 ~] # yum-y install bind bind-chroot bind-utils [root@centos01 ~] # cp / etc/named.conf / etc/named.conf.bak [root@centos01 ~] # echo "> / etc/named.conf options {listen-on port 53 {any;}; directory" / var/named ";} Zone "benet.com" IN {type master; file "benet.com.zone"; allow-transfer {192.168.100.20;}; zone "accp.com" IN {type master; file "accp.com.zone"; allow-transfer {192.168.100.20;};} [root@centos01 ~] # named-checkconf-z / etc/named.conf 2, configure the forward resolution region of the benet region [root@centos01 ~] # vim / var/named/benet.com.zone $TTL 86400 @ SOA benet.com. Root.benet.com (2020020910 1H 15m 1W 1D) @ NS centos01.benet.com. NS centos02.benet.com. Centos01 A 192.168.100.10 centos02 A 192.168.100.20 ftp A 192.168.100.10 www A 192.168.100.10 [root@centos01] # named-checkzone benet.com/ var/named/benet.com.zone zone benet.com/IN: loaded serial 2020020910OK [root@centos01 ~] # chmod 755 / var/named/benet.com.zone [root@centos01 ~] # chown named: Named/ var/named/benet.com.zone 3 、 Configure the forward parsing area [root@centos01 ~] # cp / var/named/benet.com.zone / var/named/accp.com.zone [root@centos01 ~] # vim / var/named/accp.com.zone $TTL 86400 @ SOA accp.com in the accp area. Root.accp.com (2020020910 1H 15m 1W 1D) @ NS centos01.accp.com. NS centos02.accp.com. Centos01 A 192.168.100.10 ftp A 192.168.100.10 www A 192.168.100.10 [root@centos01 ~] # named-checkzone accp.com/ var/named/accp.com.zone zone accp.com/IN: loaded serial 2020020910OK4, start the DNS service [root@centos01 ~] # systemctl start named [root@centos01 ~] # systemctl enable named 5, Add DNS [root@centos01 ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens32 DNS1=192.168.100.20 DNS2=192.168.100.10 [root@centos01 ~] # systemctl restart network [root@centos01 ~] # systemctl restart named II to the network card, install from DNS server 1, Configuration from DNS [root@centos02 ~] # yum-y install bind bind-chroot bind-utils [root@centos02 ~] # cp / etc/named.conf / etc/named.conf.bak [root@centos02 ~] # echo "" > / etc/named.conf [root@centos02 ~] # vim / etc/named.confoptions {listen-on port 53 {any }; directory "/ var/named";}; zone "benet.com" IN {type slave; file "slaves/benet.com.zone"; masters {192.168.100.10;}; zone "accp.com" IN {type slave; file "slaves/accp.com.zone"; masters {192.168.100.10;};} 2. Start the DNS service [root@centos02 ~] # systemctl start named [root@centos02 ~] # systemctl enable named3, and detect whether the master configuration file [root@centos02 ~] # cd / var/named/ [root@centos02 named] # lschroot data dynamic named.ca named.empty named.localhost named.loopback slaves [root@centos02 named] # cd slaves/ [root@centos02 slaves] # lsaccp.com.zone benet.com.zone4, Add DNS [root@centos02 ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens32DNS1=192.168.100.10DNS2=192.168.100.20 [root@centos02 ~] # systemctl restart network [root@centos02 ~] # systemctl restart named5, test DNS parsing 1) main DNS test parsing [root@centos01 ~] # nslookup ftp.benet.comServer: 192.168.100.20Address: 192.168.100.20#53Name: ftp.benet.comAddress: 192.168.100.102) client testing parsing

3) standby DNS test parsing [root@centos02 ~] # nslookup ftp.accp.comServer: 192.168.100.10Address: 192.168.100.10#53Name: ftp.accp.comAddress: 192.168.100.10 3. Configure Apache server based on domain name 1, Install and configure Apache [root@centos01 ~] # tar zxvf / mnt/httpd-2.2.17.tar.gz-C / usr/src/ [root@centos01 ~] # cd / usr/src/httpd-2.2.17/ [root@centos01 httpd-2.2.17] #. / configure-- prefix=/usr/local/httpd--enable-so-- enable-rewrite-enable-charset-lite-- enable-cgi [root@centos01 httpd-2.2.17] # make & & make install [root@centos01 ~] # ln-s / usr/local/httpd/bin/* / usr/local/bin/ [root@centos01 ~] # cp / usr/local/httpd/bin/apachectl / etc/init.d/httpd [root@centos01 ~] # chmod + x / etc/init.d/httpd [root@centos01 ~] # vim / etc/init.d/httpd # chkconfig:35 80 20 [root@centos01 ~] # chkconfig-add httpd [ Root@centos01 ~] # chkconfig-- level 35 httpd on [root@centos01 ~] # systemctl start httpd 2, Configure virtual host [root@centos01 ~] # mkdir / var/www [root@centos01 ~] # mkdir / var/www/benetcom [root@centos01 ~] # mkdir / var/www/accpcom [root@centos01 ~] # echo "www.benet.com" > / var/www/benetcom/index.html [root@centos01 ~] # echo "www.accp.com" > / var/www/accpcom/index.html [root@centos01 ~] # vim / Usr/local/httpd/conf/httpd.conf 98 ServerName 192.168.100.10 usr/local/httpd/conf/httpd.conf 80 389 Include conf/extra/httpd-vhosts.conf [root@centos01 ~] # vim / usr/local/httpd/conf/extra/httpd-vhosts.conf NameVirtualHost 192.168.100.10 usr/local/httpd/conf/httpd.conf 80 Order allow Deny allow from all DocumentRoot "/ var/www/benetcom/" ServerName www.benet.com CustomLog "logs/www.benet.com_access_log" common DocumentRoot "/ var/www/accpcom/" ServerName www.accp.com CustomLog "logs/www.accp.com_access_log" common [root@centos01 ~] # systemctl restart httpd [root@centos01 ~] # httpd-t Syntax OK 3, Client access test

-this is the end of this article. Thank you for reading-

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report