当前位置: 首页 > news >正文

网络服务第二次作业

 

[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

 

 

 

 

 

 

 


 

相关文章:

网络服务第二次作业

[rootlocalhost ~]# vim /etc/httpd/conf.d/vhosts.conf <Virtualhost 192.168.101.200:80> #虚拟主机IP及端口 DocumentRoot /www/openlab #网页文件存放目录 ServerName www.openlab.com #服务器域名 </VirtualHost> …...

【记录】USSOCOM Urban3D 数据集读取与处理

Urban3D数据集内容简介 Urban3D数据集图像为正摄RGB影像&#xff0c;分辨率为50cm。 从SpaceNet上使用aws下载数据&#xff0c;文件夹结构为&#xff1a; |- 01-Provisional_Train|- GT|- GT中包含GTC&#xff0c;GTI&#xff0c;GTL.tif文件&#xff0c;GTL为ground truth b…...

flutter ios webview不能打开http地址

参考 1、iOS添加信任 webview_flutter 在使用过程中会iOS出现无法加载HTTP请求的情况&#xff0c; 但是Flutter 却可以加载HTTP请求。这就与两个的框架有关了&#xff0c;Flutter是独立于UIKit框架的。 解决方案就是在iOS 的info.plist中添加对HTTP的信任。 <key>NSApp…...

【SpringBoot】详细介绍SpringBoot中Entity类中的getters和setters

在Spring Boot中的Entity类中&#xff0c;getters和setters是用来获取和设置对象属性值的方法。它们是Java Bean规范的一部分&#xff0c;并且通常被用于向开发人员和框架公开类的属性。 在Entity类中&#xff0c;getters和setters方法通常通过property来实现&#xff0c;即将…...

阿里云服务器搭建FRP实现内网穿透-P2P

前言 在了解frp - p2p之前&#xff0c;请先了解阿里云服务器搭建FRP实现内网穿透-转发: 文章地址 1、什么是frp - p2p frp&#xff08;Fast Reverse Proxy&#xff09;是一个开源的反向代理工具&#xff0c;它提供了多种功能&#xff0c;包括端口映射、流量转发和内网穿透等。…...

Vue3 Element-plus Upload 上传图片

技术栈&#xff1a;Vue3 Ts Element-plus 官网地址&#xff1a;Upload 上传 | Element Plus 一、背景&#xff1a; 表单上传图片功能 二、效果&#xff1a; 三、流程&#xff1a; ①点击上传图片按钮&#xff0c;系统弹出文件选择对话框&#xff0c;选择图片并确认 ②调…...

PCL | Ubuntu18安装CloudCompare

文章目录 操作教程 操作教程 CloudCompare下载官网&#xff1a;https://www.danielgm.net/cc/release/ 安装flatpak插件 sudo apt install flatpak添加库路径 flatpak remote-add flathub https://flathub.org/repo/flathub.flatpakrepo安装CC flatpak install flathub or…...

【LeetCode-中等题】138. 复制带随机指针的链表

文章目录 题目解题核心思路&#xff1a;找random指针指向思路一&#xff1a;哈希思路二&#xff1a;迭代构造新链表 方法一&#xff1a;哈希递归方法二&#xff1a;纯哈希方法三&#xff1a;迭代 节点拆分 题目 解题核心思路&#xff1a;找random指针指向 这里的拷贝属于深拷…...

C++--动态规划背包问题(1)

1. 【模板】01背包_牛客题霸_牛客网 你有一个背包&#xff0c;最多能容纳的体积是V。 现在有n个物品&#xff0c;第i个物品的体积为vivi​ ,价值为wiwi​。 &#xff08;1&#xff09;求这个背包至多能装多大价值的物品&#xff1f; &#xff08;2&#xff09;若背包恰好装满&a…...

【Android-Flutter】我的Flutter开发之旅

目录: 0、文档&#xff1a;1、在Windows上搭建Flutter开发环境&#xff08;1&#xff09;[使用中国镜像(❌详细看官方文档)](https://docs.flutter.dev/community/china)&#xff08;2&#xff09;[下载最新版Flutter SDK&#xff08;已包含Dart&#xff09;](https://docs.flu…...

【Linux】深入理解文件操作

文章目录 初次谈论文件重温C语言文件操作系统文件操作接口openwriteread 再次谈论文件文件描述符文件描述符的分配规则 重定向什么是重定向重定向的本质系统调用接口实现重定向<、>、>> 初次谈论文件 开始之前先谈论一下关于文件的一些共识性问题。 一个文件可以…...

异地使用PLSQL远程连接访问Oracle数据库【内网穿透】

文章目录 前言1. 数据库搭建2. 内网穿透2.1 安装cpolar内网穿透2.2 创建隧道映射 3. 公网远程访问4. 配置固定TCP端口地址4.1 保留一个固定的公网TCP端口地址4.2 配置固定公网TCP端口地址4.3 测试使用固定TCP端口地址远程Oracle 前言 Oracle&#xff0c;是甲骨文公司的一款关系…...

【方案】基于AI边缘计算的智慧工地解决方案

一、方案背景 在工程项目管理中&#xff0c;工程施工现场涉及面广&#xff0c;多种元素交叉&#xff0c;状况较为复杂&#xff0c;如人员出入、机械运行、物料运输等。特别是传统的现场管理模式依赖于管理人员的现场巡查。当发现安全风险时&#xff0c;需要提前报告&#xff0…...

华为各型号交换机开启SNMP v3

设备型号&#xff1a;华为S5720S-28P-LI-AC 设备软件版本&#xff1a;V200R011C10SPC600 调试命令&#xff1a; snmp-agent snmp-agent sys-info version v3 snmp-agent group v3 GroupName privacy //{GroupName}是设置一个SNMP的组名&#xff0c;我设置是SNMPGroup snm…...

CocosCreator3.8研究笔记(一)windows环境安装配置

一、安装Cocos 编辑器 &#xff08;1&#xff09;、下载Cocos Dashboard安装文件 Cocos 官方网站Cocos Dashboard下载地址 &#xff1a; https://www.cocos.com/creator-download9下载完成后会得到CocosDashboard-v2.0.1-win-082215.exe 安装文件&#xff0c;双击安装即可。 …...

【JavaWeb 专题】15个最经典的JavaWeb面试题

文章目录 HTTP长连接和短连接HTTP/1.1 与 HTTP/1.0 的区别可扩展性缓存带宽优化长连接消息传递Host 头域错误提示 AjaxAjax 的优势&#xff1a; JSP 和 servlet 有什么区别&#xff1f;定义区别 JSP 的9大内置对象及作用JSP 的 4 种作用域&#xff1f;session 和 cookie 有什么…...

力扣:75. 颜色分类(Python3)

题目&#xff1a; 给定一个包含红色、白色和蓝色、共 n 个元素的数组 nums &#xff0c;原地对它们进行排序&#xff0c;使得相同颜色的元素相邻&#xff0c;并按照红色、白色、蓝色顺序排列。 我们使用整数 0、 1 和 2 分别表示红色、白色和蓝色。 必须在不使用库内置的 sort …...

JVM 内存大对象监控和优化实践

作者&#xff1a;vivo 互联网服务器团队 - Liu Zhen、Ye Wenhao 服务器内存问题是影响应用程序性能和稳定性的重要因素之一&#xff0c;需要及时排查和优化。本文介绍了某核心服务内存问题排查与解决过程。首先在JVM与大对象优化上进行了有效的实践&#xff0c;其次在故障转移与…...

vue indexedDB 取指定数据库指定表 全部key用request.onsuccess

1 例子 export async function funcGetKey(dbName, tableName) {return new Promise((resolve, reject) > {// 打开指定的数据库const request indexedDB.open(dbName);request.onerror (event) > {console.error(打开数据库失败: , event.target.error);reject(event…...

Java 数据结构使用学习

Set和List的区别 Set 接口实例存储的是无序的&#xff0c;不重复的数据。List 接口实例存储的是有序的&#xff0c;可以重复的元素。 Set 检索效率低下&#xff0c;删除和插入效率高&#xff0c;插入和删除不会引起元素位置改变 <实现类有HashSet,TreeSet>。 List 和数…...

测试微信模版消息推送

进入“开发接口管理”--“公众平台测试账号”&#xff0c;无需申请公众账号、可在测试账号中体验并测试微信公众平台所有高级接口。 获取access_token: 自定义模版消息&#xff1a; 关注测试号&#xff1a;扫二维码关注测试号。 发送模版消息&#xff1a; import requests da…...

智慧医疗能源事业线深度画像分析(上)

引言 医疗行业作为现代社会的关键基础设施,其能源消耗与环境影响正日益受到关注。随着全球"双碳"目标的推进和可持续发展理念的深入,智慧医疗能源事业线应运而生,致力于通过创新技术与管理方案,重构医疗领域的能源使用模式。这一事业线融合了能源管理、可持续发…...

盘古信息PCB行业解决方案:以全域场景重构,激活智造新未来

一、破局&#xff1a;PCB行业的时代之问 在数字经济蓬勃发展的浪潮中&#xff0c;PCB&#xff08;印制电路板&#xff09;作为 “电子产品之母”&#xff0c;其重要性愈发凸显。随着 5G、人工智能等新兴技术的加速渗透&#xff0c;PCB行业面临着前所未有的挑战与机遇。产品迭代…...

FFmpeg 低延迟同屏方案

引言 在实时互动需求激增的当下&#xff0c;无论是在线教育中的师生同屏演示、远程办公的屏幕共享协作&#xff0c;还是游戏直播的画面实时传输&#xff0c;低延迟同屏已成为保障用户体验的核心指标。FFmpeg 作为一款功能强大的多媒体框架&#xff0c;凭借其灵活的编解码、数据…...

高频面试之3Zookeeper

高频面试之3Zookeeper 文章目录 高频面试之3Zookeeper3.1 常用命令3.2 选举机制3.3 Zookeeper符合法则中哪两个&#xff1f;3.4 Zookeeper脑裂3.5 Zookeeper用来干嘛了 3.1 常用命令 ls、get、create、delete、deleteall3.2 选举机制 半数机制&#xff08;过半机制&#xff0…...

微信小程序 - 手机震动

一、界面 <button type"primary" bindtap"shortVibrate">短震动</button> <button type"primary" bindtap"longVibrate">长震动</button> 二、js逻辑代码 注&#xff1a;文档 https://developers.weixin.qq…...

跨链模式:多链互操作架构与性能扩展方案

跨链模式&#xff1a;多链互操作架构与性能扩展方案 ——构建下一代区块链互联网的技术基石 一、跨链架构的核心范式演进 1. 分层协议栈&#xff1a;模块化解耦设计 现代跨链系统采用分层协议栈实现灵活扩展&#xff08;H2Cross架构&#xff09;&#xff1a; 适配层&#xf…...

Python爬虫(二):爬虫完整流程

爬虫完整流程详解&#xff08;7大核心步骤实战技巧&#xff09; 一、爬虫完整工作流程 以下是爬虫开发的完整流程&#xff0c;我将结合具体技术点和实战经验展开说明&#xff1a; 1. 目标分析与前期准备 网站技术分析&#xff1a; 使用浏览器开发者工具&#xff08;F12&…...

【android bluetooth 框架分析 04】【bt-framework 层详解 1】【BluetoothProperties介绍】

1. BluetoothProperties介绍 libsysprop/srcs/android/sysprop/BluetoothProperties.sysprop BluetoothProperties.sysprop 是 Android AOSP 中的一种 系统属性定义文件&#xff08;System Property Definition File&#xff09;&#xff0c;用于声明和管理 Bluetooth 模块相…...

HBuilderX安装(uni-app和小程序开发)

下载HBuilderX 访问官方网站&#xff1a;https://www.dcloud.io/hbuilderx.html 根据您的操作系统选择合适版本&#xff1a; Windows版&#xff08;推荐下载标准版&#xff09; Windows系统安装步骤 运行安装程序&#xff1a; 双击下载的.exe安装文件 如果出现安全提示&…...