DNS
DNS is the domain name at web space IP, so that people can easily access to a service site through the domain name registration. IP address is a numerical address on the network identify the site, in order to facilitate memory, the use of the domain name instead of the IP address identifies the site address. DNS is the domain name to the IP address of the conversion process. Analytical work done by the DNS domain name server.
1, the installation dns server
[the root @ localhost ~] # yum the install the bind -Y *
2, modify the configuration file
from /etc/named.conf:
listen-on port 53 { any; };
allow-query { any; };
Then create resolved:
vim /etc/named.rfc1912.zones
zone "web1.com" IN {
type master;
file "data/web1.com.zone";
};
Create the following documents in web1.com.zone / var / named / data / in
$TTL 3H
@ IN SOA web1.com. root (
20180928 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS @
IN A 192.168.159.130
www IN A 192.168.159.130
3. Start the service named:
systemctl start named
ps -ef | grep named
显示启动成功
4 Test
[root@localhost ~]# nslookup
> web1.com
Server: 192.168.159.130
Address: 192.168.159.130#53
Name: web1.com
Address: 192.168.159.130
5.dns from the domain settings
vim /etc/named.rfc1912.zones
zone "web1.com" IN {
type slave;
file "slaves/web1.com.zone";
masters { 192.168.159.130;};
};
After the restart the service:
[root@localhost ~]# nslookup
> web1.com
Server: 192.168.159.131
Address: 192.168.159.131#53
Name: web1.com
Address: 192.168.159.130
HTTP
1 HTTP installation service
yum -y install httpd
2. Edit the configuration file to create two virtual hosts
vim /etc/httpd/conf/httpd.conf
<VirtualHost 192.168.159.130:80>
ServerAdmin [email protected]
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
</VirtualHost>
<VirtualHost 192.168.159.129:80>
ServerAdmin [email protected]
ServerAdmin [email protected]
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
</VirtualHost>
3. Add an address
ip addr the Add 192.168.159.129 dev ens33
4 page document editing
[root@localhost conf]# cat /var/www/html/vhost1/index.html
床前明月光
[root@localhost conf]# cat /var/www/html/host1/index.html
日照香炉生紫烟
5 successful visit
6 configure access control
at the appropriate place of inserting the Oh Hey
<Directory "/var/www/html/vhost1">
options None
AllowOverRide AuthConfig
AuthType Basic
AuthName "wellcome to login .."
AuthBasicProvider file
AuthUserFile /etc/httpd/conf/.htpwd
Require user zhangsan lisi
</Directory>
<Directory "/var/www/html/host1">
options None
AllowOverRide AuthConfig
AuthType Basic
AuthName "wellcome to login .."
AuthBasicProvider file
AuthUserFile /etc/httpd/conf/.htpwd
Require user zhangsan lisi
</Directory>
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