rhce第二次作业

 1、搭建一个通过网址https://www.openlab.com/money访问的缴费网站,网站内容为money

安装http和插件

[root@localhost ~]#  dnf install httpd mod_ssl  -y
OS                                                       7.7 kB/s | 2.6 kB     00:00    
everything                                                10 kB/s | 2.9 kB     00:00    
EPOL                                                      11 kB/s | 2.8 kB     00:00    
debuginfo                                                 11 kB/s | 2.8 kB     00:00    
source                                                    10 kB/s | 2.7 kB     00:00    
update                                                    12 kB/s | 3.1 kB     00:00    
update-source                                            7.3 kB/s | 2.0 kB     00:00    
Dependencies resolved.
=========================================================================================
 Package                     Architecture Version                     Repository    Size
=========================================================================================
Installing:
 httpd                       x86_64       2.4.51-20.oe2203sp2         update       1.3 

[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
 

关闭防火墙

[root@localhost ~]# systemctl disable firewalld --now
[root@localhost ~]# systemctl restart nginx
Failed to restart nginx.service: Unit nginx.service not found.
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive

配置hosts文件

创建(www.openlab.com)网站

vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.179.137 www.openlab.com

创建网站对应的目录

[root@localhost ~]# mkdir -p /www/openlab
[root@localhost ~]# echo 'money' > /www/openlab/index.html
[root@localhost ~]# ls /www/openlab
index.html

编辑配置文件//重启服务器

[root@localhost ~]# vim /etc/httpd/conf.d/httpd.conf
<virtualhost 192.168.179.137>
            documentroot /www/openlab    
            servername 'www.openlab.com'  
            <directory /www/openlab>     
                     allowoverride  none  
                     require all granted
            </directory>
</virtualhost>
[root@localhost ~]# systemctl start httpd

查看

[root@localhost ~]# curl 192.168.179.137
money

2、配置DNS的正向解析

[root@localhost ~]# vim /etc/named.conf

options {
        listen-on port 53 { any; };
        directory       "/var/named";

zone "www.ceshi.com" IN {
        type master;
        file "named.www.ceshi.com";
};

[root@localhost ~]# vim /var/named/www.ceshi.com
 

$TTL 1D
@       IN SOA ns.ceshi.com admin.ceshi.com. ( 0 1D 1H 1W 3H )
        IN NS ns.ceshi.com.
ns      IN A 192.168.179.137
www IN A 192.168.179.137

 [root@localhost ~]# systemctl restart named

关闭防火墙

root@localhost ~]# systemctl disable firewalld --now

查看

[root@localhost ~]# nslookup www.ceshi.com  192.168.179.137

  • 13
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值