搭建HTTP

http作业

搭建web服务器:
[root@localhost ~]# mkdir /www
[root@localhost ~]# echo 小胖,你怎么这么胖 > /www/index.html
[root@localhost ~]# systemctl restart httpd
在这里插入图片描述
在这里插入图片描述基于域名访问:
[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf
[root@localhost ~]# mkdir /openlab
[root@localhost ~]# echo welcome to openlabd! > /openlab/index.html
在这里插入图片描述
在这里插入图片描述
使用域名访问大胖小胖
[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf
[root@localhost ~]# mkdir /openlab/{xiaopang,dapang}
[root@localhost ~]# echo this is xiaopang > /openlab/xiaopang/index.html
[root@localhost ~]# echo this is dapang > /openlab/dapang/index.html
[root@localhost ~]# systemctl restart httpd
在这里插入图片描述
在这里插入图片描述
创建虚拟目录真实目录在/usr/local/hehe:

[root@localhost ~]# mkdir /usr/local/hehe
[root@localhost ~]# echo this is hehe > /usr/local/hehe/index.html
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf
[root@localhost ~]# mkdir /usr/local/maomao
[root@localhost ~]# echo this is maomao > /usr/local/maomao/index.html

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
加密
[root@localhost maomao]# vim /etc/httpd/conf.d/vhosts.conf
[root@localhost maomao]# htpasswd -c /etc/httpd/userfile abc
New password:
Re-type new password:
Adding password for user abc
[root@localhost maomao]# htpasswd /etc/httpd/userfile xyz
New password:
Re-type new password:
Adding password for user xyz
[root@localhost maomao]# vim /etc/httpd/userfile
在这里插入图片描述
在这里插入图片描述

[root@localhost ~]# mkdir -pv /openlab/128/2/f/file/newfile/
mkdir: created directory ‘/openlab/128/2’
mkdir: created directory ‘/openlab/128/2/f’
mkdir: created directory ‘/openlab/128/2/f/file’
mkdir: created directory ‘/openlab/128/2/f/file/newfile/’
[root@localhost ~]# echo this is openlab.data > /openlab/128/2/f/file/newfile/index.html
[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf
[root@localhost ~]# mkdir -pv /openlab/128/3/f/file/newfile
mkdir: created directory ‘/openlab/128/3’
mkdir: created directory ‘/openlab/128/3/f’
mkdir: created directory ‘/openlab/128/3/f/file’
mkdir: created directory ‘/openlab/128/3/f/file/newfile’
[root@localhost ~]# echo this is openlab.money > /openlab/128/3/f/file/newfile/index.html
[root@localhost ~]# systemctl restart httpd

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
[root@localhost ~]# cd /student
[root@localhost student]# htpasswd -c /etc/httpd/userfile song
New password:
Re-type new password:
Adding password for user song
[root@localhost student]# htpasswd /etc/httpd/userfile tian
New password:
Re-type new password:
Adding password for user tian
[root@localhost student]# vim /etc/httpd/userfile
[root@localhost student]# systemctl restart httpd
在这里插入图片描述
在这里插入图片描述

[root@localhost money]# yum install mod_ssl -y
[root@localhost certs]# openssl req -newkey rsa:4096 -nodes -sha256 -keyout …/private/openlab.key -x509 -days 365 -out openlab.crt
Generating a RSA private key
Country Name (2 letter code) [XX]:86
State or Province Name (full name) []:shannxi
Locality Name (eg, city) [Default City]:xian[[D[[DHH^H
Organization Name (eg, company) [Default Company Ltd]:xianopeng
Organizational Unit Name (eg, section) []:ce
Common Name (eg, your name or your server’s hostname) []:localhs^H
Email Address []:admin@admin.com
[root@localhost certs]# ll
total 8
lrwxrwxrwx. 1 root root 49 Oct 19 2019 ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
lrwxrwxrwx. 1 root root 55 Oct 19 2019 ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
-rw-r–r--. 1 root root 3980 Mar 26 15:39 localhost.crt
-rw-r–r--. 1 root root 2130 Mar 26 20:45 openlab.crt

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值