RHCE —— 作业二

@实验要求:
搭建一个基于https://www.zuoye.com:4443访问的web网站,网站首页在/www/https/,内容为zuoye

一、安装包

[root@localhost ~]# yum install httpd -y
[root@localhost ~]# yum install mod_ssl -y

二、添加ip地址

[root@localhost ~]# nmcli connection modify ens33 ipv4.method manual +ipv4.addresses 192.168.126.140/24 ipv4.gateway 192.168.126.0 ipv4.dns 192.168.126.0 autoconnect yes  //添加ip
[root@localhost ~]# nmcli connection up ens33  //激活

三、生成私钥,颁发证书

[root@localhost conf.d]# cd /etc/pki/tls/certs/
[root@localhost certs]# openssl genrsa -aes128 2048 > https.key

RHCE —— 作业二_第1张图片
RHCE —— 作业二_第2张图片

四、配置服务

[root@localhost certs]# cd /etc/httpd/conf.d
[root@localhost conf.d]# vi https.conf

  • 文件配置为:
<VirtualHost 192.168.126.131: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 conf.d]# mkdir -p /www/https
[root@localhost conf.d]# echo zuoye > /www/https/index.html

六、重启服务

[root@localhost ~]# setenforce 0
[root@localhost conf.d]# systemctl stop firewalld.service
[root@localhost conf.d]# systemctl restart httpd
Enter TLS private key passphrase for www.zuoye.com:443 (RSA) : ******

你可能感兴趣的:(笔记,linux)