rhce第二次作业

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

 1.下载包

[root@localhost ~]# dnf install nginx -y

 

[root@localhost ~]#  nmcli connection modify ens33 +ipv4.addresses  192.168.120.150/24
[root@localhost ~]# nmcli connection up ens33
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/2)
[root@localhost ~]# mkdir -pv /www/https/money
mkdir: 已创建目录 '/www'
mkdir: 已创建目录 '/www/https'
mkdir: 已创建目录 '/www/https/money'
[root@localhost ~]# cat /www/https/money/index.html 
money

2.使用openssl命令生成自签名的ssl证书 

[root@localhost certs]#  openssl  genrsa -out  https.key
Generating RSA private key, 2048 bit long modulus (2 primes)
........................................................+++++
..........+++++
e is 65537 (0x010001)
[root@localhost certs]#  openssl req -utf8 -new -key https.key -x509 -days 100 -out https.crt
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:
Email Address []:

 

3.创建并编辑配置文件 

[root@localhost ~]#  vi /etc/nginx/conf.d/money.conf

 

4.将www.openlab.com解析为IP地址 

[root@localhost ~]# vi /etc/hosts

 

5.重启nginx服务,关闭防火墙,设置selinux 

[root@localhost ~]#  systemctl restart nginx

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

[root@localhost ~]# setenforce 0

6.测试

[root@localhost ~]# curl --insecure https://192.168.120.150
money
[root@localhost ~]# 

配置DNS的正向解析

1.装包

[root@localhost ~]# dnf install bind -y

 2.编辑配置文件

[root@localhost ~]# mv /etc/named.conf{,.bak}
[root@localhost ~]# vi /etc/named.conf

 

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

 

3.重启服务 


[root@localhost ~]# systemctl restart named
[root@localhost ~]# systemctl disable firewalld --now
[root@localhost ~]# setenforce 0

4.测试 


[root@localhost ~]# nslookup www.ceshi.com 192.168.120.153
Server:         192.168.120.153
Address:        192.168.120.153#53
 
Name:   www.ceshi.com
Address: 192.168.120.153

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值