1、配置linux客户端免密登录服务端linux主机的root用户
2、配置web服务器,当访问网站www.haha.com时显示:haha
3、配置web服务器,当访问网站www.xixi.com/secret/显示:this is secret
本实验使用RHEL9.3和Rocky linux8操作系统
RHEL9.3作服务端,Rocky linux8作客户端
RHEL9.3 IP:192.168.182.100
Rocky linux8 IP:192.168.182.150
1、配置linux客户端免密登录服务端linux主机的root用户
[root@node1 ~]# ssh-keygen -t rsa #创建密钥对
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:sww2cE/TiXGgbnojzy2CwdGPuLfF48aX2OKezVbUQgA root@node1
The key's randomart image is:
+---[RSA 3072]----+
| E.+o. |
| . =.. |
| .. o +.o. |
| . .+ o .o . |
| . o o* S. . |
| + .=.+ o. |
| +o.*ooo |
| o oB*B= |
| ..*B=+ |
+----[SHA256]-----+
将生成的公钥拷到服务端
客户端免密登录到服务端
2、配置web服务器,当访问网站www.haha.com时显示:haha
[root@localhost ~]# vim /etc/nginx/conf.d/web1.conf
注意创建root目录需改其他用户权限为读执行权限
[root@localhost ~]# chmod o+rx /root/
创建目录并写入haha
重启nginx服务
写hosts解析
访问
3、配置web服务器,当访问网站www.xixi.com/secret/显示:this is secret
[root@localhost ~]# vim /etc/nginx/conf.d/web2.conf
创建目录并写入this is secret
重启服务后写hosts解析
访问