1、配置linux客户端免密登录服务端linux主机的root用户
2、配置web服务器,当访问网站www.haha.com时显示:haha
3、配置web服务器,当访问网站www.xixi.com/secret/显示:this is secret
(这里我们用Xshell远程连接VM虚拟机完成练习)
第一题
[root@AAA ~]# ssh-copy-id root@192.168.11.133
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system. (if you think this is a mistake, you may want to use -f option)
[root@AAA ~]# ssh root@192.168.11.133
Activate the web console with: systemctl enable --now cockpit.socket
Register this system with Red Hat Insights: insights-client --register Create an account or view all your systems at Hybrid Cloud Console Last login: Sun Jul 21 21:50:32 2024 from 192.168.11.1
[root@BBB ~]#
第二题
[root@AAA ~]# nmtui
[root@AAA ~]# nmcli connection up ens160
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/4) [root@AAA ~]# mkdir /www/haha
[root@AAA ~]# echo haha > /www/haha/index.html
[root@AAA ~]# vim /etc/nginx/conf.d/test_haha.conf
server
{
listen 192.168.11.120:80;
server_name www.haha.com;
root /www/haha;
location / {
}
}
[root@AAA ~]# systemctl restart nginx
[root@AAA ~]# curl www.haha.com
haha
第三题
[root@AAA ~]# nmtui
[root@AAA ~]# nmcli connection up ens160
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/4) [root@AAA ~]# mkdir /www/secret
[root@AAA ~]# echo this is secret > /www/secret/index.html
[root@AAA ~]# systemctl restart nginx
[root@AAA ~]# vim /etc/nginx/conf.d/test_secret.conf
server{
listen 192.168.11.121:80;
server_name www.xixi.com;
root /www/secret;
location / {
}
location /secret {
alias /www/secret;
}
}
[root@AAA ~]# systemctl restart nginx
[root@AAA ~]# curl 192.168.11.121/secret/
this is secret