1.需求
两台web服务器
www.xixi.com ip:10.10.10.10
提供 www.hehe.com dns 解析
www.hh.com ip:10.10.10.11
存储:lvxixi
提供 www.xixi.com dns 解析
存储:lvhehe
开启防火墙
2相关配置
2.1修改ip地址
namcli connection modify ens160 ipv4.addresses 10.10.10.10/24 ipv4.gateway 10.10.10.2 ipv4.dns 10.10.10.11ipv4.method manual connection.autoconnect
yes
nmcli connection ens160
namcli connection modify ens160 ipv4.addresses 10.10.10.11/24 ipv4.gateway10.10.10.2 ipv4.dns 10.10.10.10 ipv4.method manual connection.autoconnect yes
nmcli connection ems160
2.2创建web服务器
cd /etc/nginx/conf.d
vim /etc/host
10.10.10.10 www.xixi.com
10.10.10.11 www.hh.com
vim hh.conf
server{
server_name www.hh.com;
root /var/www/hh/;
access_log /var/log/nginx/hh/access.log;
error_log /var/log/nginx/hh/error.log;
}
vim xixi.conf
server{
server_name www.xixi.com;
root /var/www/xixi/;
access_log /var/log/nginx/xixi/access.log;
error_log /var/log/nginx/xixi/error.log;
}
mkdir /var/www/hh/ -p
mkdir /var/www/xixi/ -p
mkdir /var/log/nginx/hh/
mkdir /var/log/nginx/xixi/
echo welcome to hh.com > /var/www/hh/index.html
echo welcome to xixi.com > /var/www/xixi/index.html
systemctl restart nginx
2.3配置解析文件
vim /etc/named.conf
options {
listen-on port {10.10.10.10;};
directory "/var/named";
};
zone "xixi.com" IN {
type master;
file "named.xixi";
};
zone "hh.com" IN {
type master;
file "named.hh";
};
vim /etc/named.conf
options {
listen-on port {10.10.10.11;};
directory "/var/named";
};
zone "xixi.com" IN {
type master;
file "named.xixi";
};
zone "hh.com" IN {
type master;
file "named.hh";
};
cd /var/named
vim named.xixi
$ TTL SOA @ admin.xixi.com (01111)
IN NS ns.xixi.com.
ns IN A 10.10.10.10
www IN A 10.10.10.11
vim named.hh
$ TTL SOA @ admin.hh.com (01111)
IN NS ns.hh.com.
ns IN A 10.10.10.10
www IN A 10.10.10.11
对端
vim named.hh
$ TTL SOA @ admin.hh.com (01111)
IN NS ns.hh.com.
ns IN A 10.10.10.11
www IN A 10.10.10.10
vim named.xixi
$ TTL SOA @ admin.xixi.com (01111)
IN NS ns.xixi.com.
ns IN A 10.10.10.11
www IN A 10.10.10.10
systemctl restart named
2.3 开启防火墙
firewall-cmd --permanent --add-service=http --add-service=dns
firewall-cmd --reload
对端同等操作开启防火墙
2.4 重启之后自动挂载
vgcreate vghh /dev/nvme0n2
lgcreate -n lghh -L 1G vghh
mkfs.xfs /dev/mapper/vghh-lvhh
vim /etc/fstab
/dev/mapper/vghh-lvhh /var/www/ xfs defaults 0 0
systemctl daemon-reload
mount -a /var/wwwdf -h /var/www
对端
vgcreate vgxixi /dev/nvmeon2
lvcreate -n lvxixi -L 1G vgxixi
mkfs.xfs /dev/mapper/vgxixi-lvxixi
vim /etc/fstab
/dev/mapper/vgxixi-lvxixi /var/www/ xfs defaults 0 0
systemctl daemon-reload
df -h /var/www