RHCE初级小练习

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

  • 5
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值