RHCE第四次作业

目录

搭建一个基于https://www.zuoye.com访问的web网站,网站首页放在/www/https/,内容为exercise

一、定义网页内容

二、生成证书、密钥

三、定义基于域名访问的网站配置文件

四、重启服务

五、关闭防火墙和selinux

六、访问测试


搭建一个基于https://www.zuoye.com访问的web网站,网站首页放在/www/https/,内容为exercise

一、定义网页内容

[root@localhost ~]# echo exercise > /www/https/index.html

二、生成证书、密钥

[root@localhost certs]# openssl genrsa -aes128 2048 > zuoye.key
Generating RSA private key, 2048 bit long modulus (2 primes)
..........+++++
..................................................................................................................+++++
e is 65537 (0x010001)
Enter pass phrase:
Verifying - Enter pass phrase:
[root@localhost certs]# openssl req -utf8 -new -key zuoye.key -x509 -days 100 -out zuoye.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]:86
State or Province Name (full name) []:gd
Locality Name (eg, city) [Default City]:gz
Organization Name (eg, company) [Default Company Ltd]:ce
Organizational Unit Name (eg, section) []:zuoye
Common Name (eg, your name or your server's hostname) []:www.zuoye.com
Email Address []:admin@zuoye.com

三、定义基于域名访问的网站配置文件

[root@localhost ~]# vim /etc/httpd/conf.d/zuoye.conf
#在zuoye.conf中写入以下配置文件
<virtualhost 192.168.190.133:443>
        servername www.zuoye.com
        documentroot /www/https
        sslengine on
        sslcertificatefile /etc/pki/tls/certs/zuoye.crt
        sslcertificatekeyfile /etc/pki/tls/certs/zuoye.key
</virtualhost>
<directory /www/https>
        allowoverride none
        require all granted
</directory>

四、重启服务

[root@localhost certs]# systemctl restart httpd
Enter TLS private key passphrase for www.zuoye.com:443 (RSA) : ****

五、关闭防火墙和selinux

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive

六、访问测试

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SUPER COW

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值