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

Realize DNS master-slave domain, http virtual host and user

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

Share

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

DNS domain name resolution is a service that points domain names to website space IP so that people can easily access websites through registered domain names. IP address is a digital address that identifies a site on the network. For convenience of memory, domain names are used instead of IP addresses to identify site addresses. Domain name resolution is the process of converting domain names into IP addresses. Domain name resolution is done by DNS servers.

1. Install DNS Server

[root@localhost ~]# yum -y install bind*

2. Modify the configuration file

In/etc/named.conf:

listen-on port 53 { any; }; allow-query { any; };

Then create a resolution:

vim /etc/named.rfc1912.zones

zone "web1.com" IN { type master; file "data/web1.com.zone"; };

Create web1.com.zone file in/var/named/data/as follows

$TTL 3H@ IN SOA web1.com. root ( 20180928 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum IN NS @ IN A 192.168.159.130www IN A 192.168.159.130

3. Start the named service:

systemctl start namedps -ef |grep named shows successful startup

4 test

[root@localhost ~]# nslookup > web1.comServer: 192.168.159.130Address: 192.168.159.130#53Name: web1.comAddress: 192.168.159.130

5. dns slave domain settings

vim /etc/named.rfc1912.zoneszone "web1.com" IN { type slave; file "slaves/web1.com.zone"; masters { 192.168.159.130;};};

After restarting the service:

[root@localhost ~]# nslookup > web1.comServer: 192.168.159.131Address: 192.168.159.131#53Name: web1.comAddress: 192.168.159.130HTTP

1 Installing HTTP Services

yum -y install httpd

2. Edit profile to create two virtual hosts

vim /etc/httpd/conf/httpd.conf

ServerAdmin webmaster@dummy-host.example.com DocumentRoot /var/www/html/host1/ ServerName 192.168.159.130 ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common ServerAdmin webmaster@dummy-host.example.com ServerAdmin webmaster@dummy-host.example.com DocumentRoot /var/www/html/host1/ ServerName 192.168.159.130 ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common

3. Add an address

ip addr add 192.168.159.129 dev ens33

4 Edit Home File

[root@localhost conf]#cat/var/www/html/vhost1/index.html [root@localhost conf]#cat/var/www/html/host1/index.html

5 successful visits

6 Configuring access control

Insert the following in the corresponding place

options None AllowOverRide AuthConfig AuthType Basic AuthName "wellcome to login .. " AuthBasicProvider file AuthUserFile /etc/httpd/conf/.htpwd Require user zhangsan lisi options None AllowOverRide AuthConfig AuthType Basic AuthName "wellcome to login .. " AuthBasicProvider file AuthUserFile /etc/httpd/conf/.htpwd Require user zhangsan lisi

Create a user password

htpasswd -c -m /etc/httpd/conf/.htpwd zhangsan htpasswd -m /etc/httpd/conf/.htpwd lisi htpasswd -m /etc/httpd/conf/.htpwd wangwu

7 Access control

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