网络服务第二次作业

[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影像,分辨率为50cm。 从SpaceNet上使用aws下载数据,文件夹结构为: |- 01-Provisional_Train|- GT|- GT中包含GTC,GTI,GTL.tif文件,GTL为ground truth b…...
flutter ios webview不能打开http地址
参考 1、iOS添加信任 webview_flutter 在使用过程中会iOS出现无法加载HTTP请求的情况, 但是Flutter 却可以加载HTTP请求。这就与两个的框架有关了,Flutter是独立于UIKit框架的。 解决方案就是在iOS 的info.plist中添加对HTTP的信任。 <key>NSApp…...
【SpringBoot】详细介绍SpringBoot中Entity类中的getters和setters
在Spring Boot中的Entity类中,getters和setters是用来获取和设置对象属性值的方法。它们是Java Bean规范的一部分,并且通常被用于向开发人员和框架公开类的属性。 在Entity类中,getters和setters方法通常通过property来实现,即将…...
阿里云服务器搭建FRP实现内网穿透-P2P
前言 在了解frp - p2p之前,请先了解阿里云服务器搭建FRP实现内网穿透-转发: 文章地址 1、什么是frp - p2p frp(Fast Reverse Proxy)是一个开源的反向代理工具,它提供了多种功能,包括端口映射、流量转发和内网穿透等。…...
Vue3 Element-plus Upload 上传图片
技术栈:Vue3 Ts Element-plus 官网地址:Upload 上传 | Element Plus 一、背景: 表单上传图片功能 二、效果: 三、流程: ①点击上传图片按钮,系统弹出文件选择对话框,选择图片并确认 ②调…...
PCL | Ubuntu18安装CloudCompare
文章目录 操作教程 操作教程 CloudCompare下载官网: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. 复制带随机指针的链表
文章目录 题目解题核心思路:找random指针指向思路一:哈希思路二:迭代构造新链表 方法一:哈希递归方法二:纯哈希方法三:迭代 节点拆分 题目 解题核心思路:找random指针指向 这里的拷贝属于深拷…...
C++--动态规划背包问题(1)
1. 【模板】01背包_牛客题霸_牛客网 你有一个背包,最多能容纳的体积是V。 现在有n个物品,第i个物品的体积为vivi ,价值为wiwi。 (1)求这个背包至多能装多大价值的物品? (2)若背包恰好装满&a…...
【Android-Flutter】我的Flutter开发之旅
目录: 0、文档:1、在Windows上搭建Flutter开发环境(1)[使用中国镜像(❌详细看官方文档)](https://docs.flutter.dev/community/china)(2)[下载最新版Flutter SDK(已包含Dart)](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,是甲骨文公司的一款关系…...
【方案】基于AI边缘计算的智慧工地解决方案
一、方案背景 在工程项目管理中,工程施工现场涉及面广,多种元素交叉,状况较为复杂,如人员出入、机械运行、物料运输等。特别是传统的现场管理模式依赖于管理人员的现场巡查。当发现安全风险时,需要提前报告࿰…...
华为各型号交换机开启SNMP v3
设备型号:华为S5720S-28P-LI-AC 设备软件版本:V200R011C10SPC600 调试命令: snmp-agent snmp-agent sys-info version v3 snmp-agent group v3 GroupName privacy //{GroupName}是设置一个SNMP的组名,我设置是SNMPGroup snm…...
CocosCreator3.8研究笔记(一)windows环境安装配置
一、安装Cocos 编辑器 (1)、下载Cocos Dashboard安装文件 Cocos 官方网站Cocos Dashboard下载地址 : https://www.cocos.com/creator-download9下载完成后会得到CocosDashboard-v2.0.1-win-082215.exe 安装文件,双击安装即可。 …...
【JavaWeb 专题】15个最经典的JavaWeb面试题
文章目录 HTTP长连接和短连接HTTP/1.1 与 HTTP/1.0 的区别可扩展性缓存带宽优化长连接消息传递Host 头域错误提示 AjaxAjax 的优势: JSP 和 servlet 有什么区别?定义区别 JSP 的9大内置对象及作用JSP 的 4 种作用域?session 和 cookie 有什么…...
力扣:75. 颜色分类(Python3)
题目: 给定一个包含红色、白色和蓝色、共 n 个元素的数组 nums ,原地对它们进行排序,使得相同颜色的元素相邻,并按照红色、白色、蓝色顺序排列。 我们使用整数 0、 1 和 2 分别表示红色、白色和蓝色。 必须在不使用库内置的 sort …...
JVM 内存大对象监控和优化实践
作者:vivo 互联网服务器团队 - Liu Zhen、Ye Wenhao 服务器内存问题是影响应用程序性能和稳定性的重要因素之一,需要及时排查和优化。本文介绍了某核心服务内存问题排查与解决过程。首先在JVM与大对象优化上进行了有效的实践,其次在故障转移与…...
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 接口实例存储的是无序的,不重复的数据。List 接口实例存储的是有序的,可以重复的元素。 Set 检索效率低下,删除和插入效率高,插入和删除不会引起元素位置改变 <实现类有HashSet,TreeSet>。 List 和数…...
椭圆曲线密码学(ECC)
一、ECC算法概述 椭圆曲线密码学(Elliptic Curve Cryptography)是基于椭圆曲线数学理论的公钥密码系统,由Neal Koblitz和Victor Miller在1985年独立提出。相比RSA,ECC在相同安全强度下密钥更短(256位ECC ≈ 3072位RSA…...
PHP和Node.js哪个更爽?
先说结论,rust完胜。 php:laravel,swoole,webman,最开始在苏宁的时候写了几年php,当时觉得php真的是世界上最好的语言,因为当初活在舒适圈里,不愿意跳出来,就好比当初活在…...
IP如何挑?2025年海外专线IP如何购买?
你花了时间和预算买了IP,结果IP质量不佳,项目效率低下不说,还可能带来莫名的网络问题,是不是太闹心了?尤其是在面对海外专线IP时,到底怎么才能买到适合自己的呢?所以,挑IP绝对是个技…...
GO协程(Goroutine)问题总结
在使用Go语言来编写代码时,遇到的一些问题总结一下 [参考文档]:https://www.topgoer.com/%E5%B9%B6%E5%8F%91%E7%BC%96%E7%A8%8B/goroutine.html 1. main()函数默认的Goroutine 场景再现: 今天在看到这个教程的时候,在自己的电…...
C++ 设计模式 《小明的奶茶加料风波》
👨🎓 模式名称:装饰器模式(Decorator Pattern) 👦 小明最近上线了校园奶茶配送功能,业务火爆,大家都在加料: 有的同学要加波霸 🟤,有的要加椰果…...
《Docker》架构
文章目录 架构模式单机架构应用数据分离架构应用服务器集群架构读写分离/主从分离架构冷热分离架构垂直分库架构微服务架构容器编排架构什么是容器,docker,镜像,k8s 架构模式 单机架构 单机架构其实就是应用服务器和单机服务器都部署在同一…...
智能职业发展系统:AI驱动的职业规划平台技术解析
智能职业发展系统:AI驱动的职业规划平台技术解析 引言:数字时代的职业革命 在当今瞬息万变的就业市场中,传统的职业规划方法已无法满足个人和企业的需求。据统计,全球每年有超过2亿人面临职业转型困境,而企业也因此遭…...
图解JavaScript原型:原型链及其分析 | JavaScript图解
忽略该图的细节(如内存地址值没有用二进制) 以下是对该图进一步的理解和总结 1. JS 对象概念的辨析 对象是什么:保存在堆中一块区域,同时在栈中有一块区域保存其在堆中的地址(也就是我们通常说的该变量指向谁&…...
字符串哈希+KMP
P10468 兔子与兔子 #include<bits/stdc.h> using namespace std; typedef unsigned long long ull; const int N 1000010; ull a[N], pw[N]; int n; ull gethash(int l, int r){return a[r] - a[l - 1] * pw[r - l 1]; } signed main(){ios::sync_with_stdio(false), …...
Linux基础开发工具——vim工具
文章目录 vim工具什么是vimvim的多模式和使用vim的基础模式vim的三种基础模式三种模式的初步了解 常用模式的详细讲解插入模式命令模式模式转化光标的移动文本的编辑 底行模式替换模式视图模式总结 使用vim的小技巧vim的配置(了解) vim工具 本文章仍然是继续讲解Linux系统下的…...
