搭建静态网站——基于https协议的静态网站(待补完)

系列文章目录



前言

搭建过程

mount /dev/sr0 /mnt
yum install httpd -y
vim /etc/httpd/conf.d/vhost.conf

<VirtualHost 192.168.199.136>
DocumentRoot /www/html
Servername www.openlab.com
Alias /data /www/html/data
Alias /student /www/html/student
#Alias /money /www/html/money
#SSlEngine on
#SSlCertificateFile /etc/pki/tls/certs/openlab.crt
#SSlCertificatekeyFile /etc/pki/tls/certs/openlab.key

<Directory /www>
AllowOverride none
Require all granted

<Directory /www/html/student/>
AllowOverride none
AuthType Basic
AuthName “输入学生账号”
AuthUserfile /etc/httpd/users
Require user song tian

<VirtualHost 192.168.199.136:443>
DocumentRoot /www/html
Alias /money /www/html/money
Servername www.openlab.com
SSlEngine on
SSlCertificateFile /etc/pki/tls/certs/openlab.crt
SSlCertificatekeyFile /etc/pki/tls/certs/openlab.key

<Directory /www/html/money>
AllowOverride none
Require all granted

systemctl restart httpd
systemctl stop firewall

mkdir -p /www/html/{data,money,student}
echo hello world > /www/html/index.html
echo hello S > /www/html/data/index.html
echo hello world > /www/html/student/index.html

htpasswd -c /etc/httpd/users song
htpasswd /etc/httpd/users tian

yum install mod_ssl
cd /etc/pki/tls/certs
openssl req -newkey rsa:4096 -nodes -sha256 -keyout openlab.key -x509 -days 365 -out openlab.crt
86
vim /etc/host
192.168.199.136 www.openlab.com
在 win10 host文件 C:\Windows\System32\drivers\etc 的hosts文件后添加如下
192.168.199.136 www.openlab.com

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值