网络服务第二次作业

news2024/10/6 5:53:06

 

[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf 

<Virtualhost 192.168.101.200:80>           #虚拟主机IP及端口
        DocumentRoot  /www/openlab        #网页文件存放目录
        ServerName www.openlab.com      #服务器域名
</VirtualHost>

<Directory /www>
        AllowOverride none                          #不允许覆盖
        Require all granted                           #允许访问
</Directory>

#利用本机的/etc/hosts文件做域名解析

[root@localhost ~]# vim /etc/hosts
192.168.101.200  www.openlab.com

#创建网页根目录

[root@localhost ~]# mkdir -p /www/openlab

#编辑网页内容

[root@localhost ~]# echo 'welcome to openlab!!!' > /www/openlab/index.html

#重启hppd服务

[root@localhost ~]# systemctl restart httpd

[root@localhost ~]# setenforce 0

#Client主机测试

[root@localhost ~]# curl www.openlab.com

welcome to openlab!!!

 

 

[root@server ~]# mkdir -p /www/openlab

[root@server ~]# systemctl restart httpd

[root@server ~]# vim  /etc/hosts

[root@server ~]# vim  /etc/httpd/conf.d/userdir.conf

[root@server ~]# vim  /etc/httpd/conf.d/userdir.conf

[root@server ~]# mkdir -p /www/openlab/student

[root@server ~]# mkdir -p /www/openlab/data

[root@server ~]# mkdir -p /www/openlab/money

[root@server ~]# vim  /etc/hosts

[root@server ~]# vim  /etc/hosts

[root@server ~]# vim  /etc/httpd/conf/httpd.conf

[root@server ~]# systemctl restart httpd

[root@server ~]# systemctl restart httpd

[root@server ~]# vim  /etc/hosts

[root@server ~]# vim  /etc/httpd/conf/httpd.conf

[root@server ~]# vim  /etc/httpd/conf/httpd.conf

[root@server ~]# echo 'this is openlab data' > /www/openlab/data/index.html

[root@server ~]# echo 'this is openlab student' > /www/openlab/student/index.html

[root@server ~]# systemctl restart httpd

[root@server ~]# systemctl restart httpd

[root@server ~]# echo 'this is openlab money' > /www/openlab/money/index.html

[root@server ~]# vim  /etc/httpd/conf/httpd.conf

[root@server ~]# systemctl restart httpd

[root@server ~]#

 

 

学生信息网站只有song和tian两人可以访问,其他用户不能访问

[root@server ~]# vim  /etc/httpd/conf.d/userdir.conf 
    #UserDir disabled      # 此行增加#,注释掉,表示开放个人用户主页功能
    UserDir /www/openlab/student    # 此行去掉#,表示网站数据保存在/www/openlab/student
 
[root@server ~]# useradd  song
[root@server ~]# passwd   song
更改用户 song 的密码 。
新的密码:                   # 密码123456
无效的密码: 密码少于 8 个字符
重新输入新的密码: 
passwd:所有的身份验证令牌已经成功更新。
 
[root@server ~]# useradd  tian
[root@server ~]# passwd   tian
更改用户 tian 的密码 。
新的密码:                  # 密码654321
无效的密码: 密码少于 8 个字符
重新输入新的密码: 
passwd:所有的身份验证令牌已经成功更新。
 
[root@server ~]$ chmod  -Rf  755  /www/openlab/student  # 设置访问权限
 
[root@server ~]# systemctl restart  httpd
 
[root@server ~]# htpasswd  -c  /etc/httpd/passwd  song
New password:            # 123456
Re-type new password: 
Adding password for user song
 
# htpasswd : 生成密码数据的命令
# -c : 表示第一次生成,第二次给账户创建密码不能使用
#  /etc/httpd/passwd : 存储密码的数据库文件
# song : 需要验证密码访问的账户名称
 
# 给tian账户这只访问控制,密码
[root@server ~]# htpasswd  /etc/httpd/passwd tian
New password: 
Re-type new password: 
Adding password for user tian
# 注意:第二次给tian账户设置密码,不能加-c参数,否则会覆盖
 
[root@server ~]# vim  /etc/httpd/conf/httpd.conf
#dd删除这里
#<VirtualHost  192.168.119.138>
#         DocumentRoot    /www/openlab/student
#         ServerName      'www.openlab.com/student'
#         alias /data /www/openlab/student
#         <Directory  /www/openlab/student>
#                AllowOverride  None
#                require all granted
#         </Directory>
# </VirtualHost>
 
[root@server ~]# vim  /etc/httpd/conf.d/userdir.conf 
# 定位第31-35行,删除后增加如下内容:
<Directory "/www/openlab/student">
        authuserfile   "/etc/httpd/passwd"
        authname       "My  privately  website"
        authtype       basic
        require  user  song
</Directory>
<Directory "/www/openlab/student">
        authuserfile   "/etc/httpd/passwd"
        authname       "My  privately  website"
        authtype       basic
        require  user  tian
</Directory>
 
[root@server ~]# systemctl restart httpd
# windows端打开浏览器,输入www.openlab.com/student,此时会有对话框出现需要输入密码

 

 

 

https服务

[root@server ~]# yum  install  mod_ssl  -y
 
[root@server ~]# cd  /etc/pki/tls/private/
[root@server private]# openssl  genrsa  -aes128   2048  >  money.key
Enter PEM pass phrase:   # 设置私钥文件的加密密码 ,123456
Verifying - Enter PEM pass phrase:      # 重输密码,123456
 
[root@server private]# cd  /etc/pki/tls/certs/
[root@server certs]# openssl  req  -utf8  -new  -key  /etc/pki/tls/private/money.key  -x509  -days  365  -out  money.crt
 
Enter pass phrase for /etc/pki/tls/private/zy.key:  # 输入私钥加密的密码123456
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) []:shacnxi
Locality Name (eg, city) [Default City]:xi'an
Organization Name (eg, company) [Default Company Ltd]:OpenLab
Organizational Unit Name (eg, section) []:Finance
Common Name (eg, your name or your server's hostname) []:server
Email Address []:2297373285@qq.com
 
[root@server ~]# vim  /etc/httpd/conf/httpd.conf
#dd删除这里
#<VirtualHost  192.168.119.138>
#         DocumentRoot    /www/openlab/money
#         ServerName      'www.openlab.com/money'
#         alias /money  /www/openlab/data
#         <Directory  /www/openlab/money>
#               AllowOverride  None
#                require all granted
#         </Directory>
# </VirtualHost>
 
[root@server ~]# vim  /etc/httpd/conf.d/ssl.conf
<VirtualHost  192.168.119.138:443>   
        SSLEngine on                
        SSLCertificateFile /etc/pki/tls/certs/money.crt
        SSLCertificateKeyFile /etc/pki/tls/private/money.key
        ServerName      'www.openlab.com/money'
        DocumentRoot    /www/openlab/money 
        alias /money /www/openlab/money
</VirtualHost>
 
<Directory  /www/openlab/money>                 
        AllowOverride  none
        Require all granted
</Directory>
 
[root@server ~]# systemctl start httpd
 Enter TLS private key passphrase for 192.168.48.130:443 (RSA) : ******       # 输入私钥的密码:123456

 

 

 

 

 

 

 


 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/942217.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

java 桥接模式

桥接模式 桥接模式简介桥接模式的实现总结 桥接模式简介 桥接模式&#xff08;Bridge&#xff09;是将抽象部分与它的实现部分分离&#xff0c;使它们都可以独立地变化。它是一种对象结构型模式&#xff0c;又称为柄体(Handle and Body)模式或接口(Interfce)模式。 桥接模式基于…

C# VS调试技巧

一.按照条件调试步骤 ①在需要代码执行的行打断点 ②触发此断点&#xff0c;让代码执行到此处 ③鼠标滑至在断点处&#xff0c;点击设置 ④设置断点条件&#xff0c;如下图所示 二、多线程调试技巧 ①在需要代码执行的行打断点 ②触发此断点&#xff0c;让代码执行到此处…

微服务dubbo和nexus

微服务是一种软件开发架构风格&#xff0c;它将一个应用程序拆分成一组小型、独立的服务&#xff0c;每个服务都可以独立部署、管理和扩展。每个服务都可以通过轻量级的通信机制&#xff08;通常是 HTTP/REST 或消息队列&#xff09;相互通信。微服务架构追求高内聚、低耦合&am…

本地启动若依微服务版本

前置工作&#xff1a; 1.导入sql文件 2.安装完nacos 3.安装完redis 启动步骤&#xff1a; 1.开启nacos&#xff0c;在bin目录下 startup.cmd -m standalone 注意&#xff1a;在这之前要配置nacos持久化&#xff0c;修改conf/application.properties文件&#xff0c;增加支持…

打架斗殴监测识别算法 yolov8

打架斗殴监测识别算法采用yolov8先进的图像处理和机器学习算法框架模型&#xff0c;打架斗殴监测识别算法能够自动识别和分析出打架斗殴的行为特征。一旦系统检测到打架斗殴行为&#xff0c;将自动触发告警。YOLO的结构非常简单&#xff0c;就是单纯的卷积、池化最后加了两层全…

SpringBoot初级开发--加入ElasticSearch数据源(4)

ES就不用我说了吧&#xff0c;如果是安装的话可以参考我这边blog《Centos7.9安装ElasticSearch6》&#xff0c;安装好ES&#xff0c;接下来我们配置SpringBoot.在配置之前&#xff0c;先看看版本对应表。 1.修改POM文件的依赖 <!-- ES 默认对应springboot的版本 --><…

未来科技城携手加速科技 共建集成电路测试公共服务平台!

8月26日&#xff0c;2023未来产业发展大会在杭州未来科技城国际会议中心开幕&#xff01;会上&#xff0c;发布了未来科技城培育发展未来产业行动计划&#xff0c;启动了未来产业发展共同体&#xff0c;进行了未来产业公共服务平台签约仪式。未来科技城与加速科技签约共建集成电…

Linux枚举文件目录、获取文件属性

目录 1.枚举指定路径下的文件目录2.获取文件属性stat其他方式&#xff1a;Linux获取文件属性stat()、fstat()、lstat()函数实现stat属性代码 1.枚举指定路径下的文件目录 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.…

java+springboot+mysql水电管理系统

项目介绍&#xff1a; 本系统为新版基于SpringBoot的水电管理系统&#xff1a; 使用javaspringbootmysql开发的水电费管理系统&#xff0c;系统包含超级管理员&#xff0c;系统管理员、用户角色&#xff0c;功能如下&#xff1a; 超级管理员&#xff1a;管理员管理、用户管理…

成功通过技术面试的策略:程序员必备指南

&#x1f337;&#x1f341; 博主猫头虎 带您 Go to New World.✨&#x1f341; &#x1f984; 博客首页——猫头虎的博客&#x1f390; &#x1f433;《面试题大全专栏》 文章图文并茂&#x1f995;生动形象&#x1f996;简单易学&#xff01;欢迎大家来踩踩~&#x1f33a; &a…

2023-8-28 图中点的层次(树与图的广度优先遍历)

题目链接&#xff1a;图中点的层次 #include <iostream> #include <cstring> #include <algorithm>using namespace std;const int N 100010;int h[N], e[N], ne[N], idx; int n, m; int q[N], d[N];void add(int a, int b) {e[idx] b, ne[idx] h[a], h…

小蜗语音工具1.9、文本,小说,字幕生成语音、多角色对话,语音识别、读取音频字幕

小蜗语音免费工具 一、文本转字幕文本内容和TXT文件 二、文本转语音1、文本内容生成语音2、字幕生成语音3、多角色对话4、选择文件5、批量处理 三、语音识别、音频MP31、语音识别2、下载模型下载地址 一、文本转字幕 可以把正本小说&#xff0c;生成字幕文件。不限制文件的大小…

Exchange-CVE-2020-0688(RCE)

漏洞描述 当攻击者通过各种手段获得一个可以访问Exchange Control Panel &#xff08;ECP&#xff09;组件的用户账号密码&#xff0c;就可以在被攻击的exchange上执行任意代码&#xff0c;直接获取服务器权限。 CVE-2020-0688也是因为viewstate反序列化 漏洞版本 利用条件&…

雅思听力考点词 积累

目录 雅思听力4个部分 雅思听力答题策略 雅思听力12大场景词汇 1 求职 2 图书馆 3 生活 4 天气地形 5 医疗 6 旅游 7 住宿 8 入学 9 运动 10 环境 11 教育 12 音乐 雅思听力 Part 1 4.1 听力Part 1主要内容 4.2 听力Part 1主要题型&#xff1a;Form Completi…

jq插件:jqgrid和validform的二次封装

做久了vue和react框架项目&#xff0c;偶尔也需要做做原生的项目。不可否认vue的双向绑定机制确实很香&#xff0c;但是也是建立在原生js基础上。所以&#xff0c;只有做更多的原生js项目&#xff0c;才能更加了解vue框架的底层原理。在日常开发中&#xff0c;也会不可避免的会…

element-ui 弹窗里面嵌套弹窗,解决第二个弹窗被遮罩层掩盖无法显示的问题

当我们在 element-ui 中使用弹窗嵌套弹窗时&#xff0c;会出现第二个弹窗打开时被一个遮罩层挡着&#xff0c;就像下面这样&#xff1a; 下面提供两种解决方案 &#xff1a; 一、第一种方案 我们查询element-ui 官网可以发现 el-dialog 有这样几个属性&#xff1a; 具体使用就…

【C语言基础】const关键词的使用方法

&#x1f4e2;&#xff1a;如果你也对机器人、人工智能感兴趣&#xff0c;看来我们志同道合✨ &#x1f4e2;&#xff1a;不妨浏览一下我的博客主页【https://blog.csdn.net/weixin_51244852】 &#x1f4e2;&#xff1a;文章若有幸对你有帮助&#xff0c;可点赞 &#x1f44d;…

App卡帧与BlockCanary

作者&#xff1a;图个喜庆 一&#xff0c;前言 app卡帧一直是性能优化的一个重要方面&#xff0c;虽然现在手机硬件性能越来越高&#xff0c;明显的卡帧现象越来越少&#xff0c;但是了解卡帧相关的知识还是非常有必要的。 本文分两部分从app卡帧的原理出发&#xff0c;讨论屏…

《Flink学习笔记》——第六章 Flink的时间和窗口

6.1 时间语义 6.1.1 Flink中的时间语义 对于一台机器而言&#xff0c;时间就是系统时间。但是Flink是一个分布式处理系统&#xff0c;多台机器“各自为政”&#xff0c;没有统一的时钟&#xff0c;各自有各自的系统时间。而对于并行的子任务来说&#xff0c;在不同的节点&…

mysql 8 jdbc连接报错:Caused by: java.sql.SOLNonTransientConnectionException: Cannot load connection clas

问题现象&#xff1a;如下图所示&#xff1a; 错误信息为&#xff1a; Caused by: java.sql.SOLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.e 32 xceptions.WrongArgumentException: Malformed database …