基于https协议的静态网站 HTTPS(全称:Hyper Text Transfer Protocol over Secure Socket Layer 或 Hypertext Transfer Protocol Secure,超文本传输安全协议),是以安全为目标的HTTP通道。HTTPS并不是一个新协议,而是HTTP+SSL(TLS)。原本HTTP先和TCP(假定传输层是TCP协议)直接通信,而加了SSL后,就变成HTTP先和SSL通信,再由SSL和TCP通信,相当于SSL被嵌在了HTTP和TCP之间。
内容: 搭建一个基于https://www.zuoye.com:4443访问的web网站,网站首页在/www/https/,内容为zuoye
版本:rhet8.2
首先建立新的IP地址192.168.18.12/24
第一步:安装https
[root@localhost ~]
第二步:创建文件,编辑网页内容
[root@localhost ~]
mkdir: 已创建目录 '/www/https'
[root@localhost ~]
第三步:配置文件
[root@localhost ~]
listen 4443
<VirtualHost 192.168.18.12:4443>
DocumentRoot /www/https
ServerName www.zuoye.com
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/https.crt
SSLCertificateKeyFile /etc/pki/tls/certs/https.key
</VirtualHost>
<Directory /www/https>
AllowOverride None
Require all granted
</Directory>
第四步:生成密钥和证书
[root@localhost ~]
[root@localhost certs]
[root@localhost certs]
Enter pass phrase for https.key:
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) [XX]:12
State or Province Name (full name) []:34
Locality Name (eg, city) [Default City]:56
Organization Name (eg, company) [Default Company Ltd]:wq
Organizational Unit Name (eg, section) []:ww
Common Name (eg, your name or your server's hostname) []:www.zuoye.com
Email Address []:qq@qq
第五步:在Linux和window分别添加域名
[root@localhost ~]
192.168.18.12 www.zuoye.com
C:\Windows\System32\drivers\etc\hosts
192.168.18.12 www.zuoye.com
第六步:关闭防火墙 重启httpd,访问www.zuoye.com
[root@localhost conf.d]
[root@localhost conf.d]
[root@localhost conf.d]
|