搭建一个通过网址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