RHCE第三次作业

一、作业要求

 二、作业内容

1、需求1

[root@localhost ~]# rpm -ql httpd-core | grep  host
/usr/share/doc/httpd-core/httpd-vhosts.conf
[root@localhost ~]# rpm -ql httpd-core | grep etc
[root@localhost ~]# cd /etc/httpd/conf.d
[root@localhost conf.d]# cp /usr/share/doc/httpd-core/httpd-vhosts.conf ./zuoye.conf

将该文件复制到当前目录下创建zuoye.conf

[root@localhost conf.d]# vim zuoye.conf 
<VirtualHost 192.168.226.60:80>
    DocumentRoot /www/zuoye/
    ServerName www.openlab.com
    ErrorLog "/var/log/httpd/openlab-error_log"
    CustomLog "/var/log/httpd/openlab-access_log" common
</VirtualHost>
<directory /www/zuoye>
    allowoverride none
    require all granted
</directory>
 
[root@localhost conf.d]# mkdir /www/zuoye -p

创建目录

[root@localhost conf.d]# echo "welcome to openlab" > /www/zuoye/index.html

创建网页文件

[root@localhost conf.d]# systemctl status firewalld

查看防火墙是否关闭

[root@localhost conf.d]# setenforce 0
[root@localhost conf.d]# getenforce 
Permissive
[root@localhost conf.d]# systemctl restart httpd

重启服务
测试:

[root@localhost conf.d]# curl 192.168.226.60
welcome to openlab
[root@localhost conf.d]# vim /etc/hosts
192.168.226.60 www.openlab.com
[root@localhost conf.d]# ping www.openlab.com
PING www.openlab.com (192.168.226.60) 56(84) bytes of data.
64 bytes from www.openlab.com (192.168.226.60): icmp_seq=1 ttl=64 time=0.032 ms
[root@localhost conf.d]# curl www.openlab.com
welcome to openlab

2、需求2

给公司创建三个子页面

[root@localhost conf.d]# cd /www/zuoye
[root@localhost zuoye]# mkdir student data money

在/www/zuoye下创建这三个目录

[root@localhost zuoye]# echo money > ./money/index.html
[root@localhost zuoye]# echo student > ./student/index.html
[root@localhost zuoye]# echo data > ./data/index.html
 
[root@localhost zuoye]# curl 192.168.226.60/student
[root@localhost zuoye]# curl 192.168.226.60/student -L
student

测试

[root@localhost zuoye]# curl http://www.openlab.com/data/
data
[root@localhost zuoye]# curl http://www.openlab.com/student/
student
[root@localhost zuoye]# curl http://www.openlab.com/money/
money

3、要求

创建用户 指定用户名及密码

[root@localhost ~]# htpasswd -c /etc/httpd/userfile song
New password: 
Re-type new password: 
Adding password for user song
[root@server ~]# htpasswd /etc/httpd/userfile tian
New password: 
Re-type new password: 
Adding password for user tian

创建网页文件根目录

[root@server ~]# mkdir /www/openlab/student

重启httpd服务

[root@server ~]# systemctl restart httpd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值