RHCE作业二
作者:互联网
RHCE实验:
搭建一个基于https://www.zuoye.com:4443访问的web网站,网站首页在/www/https/,内容为zuoye
版本:rhet8
首先建立新的IP地址192.168.18.12/24
第一步:安装https
[root@localhost ~]# yum -y install mod_ssl
第二步:创建文件,编辑网页内容
[root@localhost ~]# mkdir -pv /www/https
mkdir: 已创建目录 '/www/https'
[root@localhost ~]# echo zuoye > /www/https/index.html
第三步:配置文件
/etc/httpd/conf.d/https.conf
[root@localhost ~]# vim /etc/httpd/conf.d/https.conf
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 ~]# cd /etc/pki/tls/certs/
[root@localhost certs]# openssl genrsa -aes128 2048 > https.keys
[root@localhost certs]# openssl req -utf8 -new -key https.key -x509 -days 365 -out localhost.crt
[root@localhost conf.d]# openssl req -utf8 -new -key https.key -x509 -days 365 -out localhost.crt
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
第五步:关闭防火墙 重启httpd,访问www.zuoye.com
[root@localhost conf.d]# setenforce 0
[root@localhost conf.d]# systemctl stop firewalld
[root@localhost conf.d]# systemctl start httpd
[root@localhost conf.d]# curl https://www.zuoye.com:4443 -k
标签:www,conf,zuoye,RHCE,作业,https,root,localhost 来源: https://blog.csdn.net/weixin_53176674/article/details/120573682