1、搭建一个通过网址https://www.openlab.com/money访问的缴费网站,网站内容为money
[root@rhce ~]# mkdir -pv /www/https/money
[root@rhce ~]# echo money > /www/https/money/index.html
[root@rhce ~]cd /etc/pki/tls/certs/
[root@rhce certs]# openssl genrsa -out https.key
Generating RSA private key, 2048 bit long modulus (2 primes)
...............+++++
..........................................+++++
e is 65537 (0x010001)
[root@rhce 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 []:
[root@rhce ~]# vim /etc/nginx/conf.d/money.conf
server {
listen 192.168.126.156:443 ssl;
server_name www.openlab.com;
root /www/https;
ssl_certificate /etc/pki/tls/certs/https.crt;
ssl_certificate_key /etc/pki/tls/certs/https.key;
location /money {
index index.html;
}
}
[root@rhce ~]# vim /etc/hosts
192.168.126.156 www.openlab.com
[root@rhce ~]# systemctl restart nginx
[root@rhce ~]# systemctl disable --now firewalld
[root@rhce ~]# setenforce 0
[root@rhce ~]# curl --insecure https://www.openlab.com/money/
Money
2、配置DNS的正向解析
[root@localhost ~]# vim /etc/named.conf
options {
listen-on port 53 { 192.168.126.133; };
directory "/var/named";
};
zone "ceshi.com" IN {
type master;
file "named.ceshi.com";
};
[root@localhost ~]# vim /var/named/named.ceshi.com
$TTL 1D
@ IN SOA @ admin.baidu.com. ( 0 1D 1H 1W 3H )
IN NS ns.ceshi.com.
ns IN A 192.168.126.133
www IN A 192.168.126.133
[root@localhost ~]# systemctl restart named
[root@localhost ~]# systemctl disable firewalld --now
[root@localhost ~]# setenforce 0
[root@localhost ~]# nslookup www.ceshi.com 192.168.126.133
Server: 192.168.126.133
Address: 192.168.126.133#53
Name: www.ceshi.com
Address: 192.168.126.133