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

第八章 使用Apache服务部署静态网站

文章目录

    • 第八章 使用Apache服务部署静态网站
        • 一、网站服务程序
          • 1、网站服务介绍
          • 2、Apache程序介绍
        • 二、配置服务文件参数
          • 1、Linux系统中的配置文件
          • 2、配置httpd服务程序时最常用的参数以及用途描述
        • 三、SELinux安全子系统
          • 1、SELinux介绍
          • 2、SELinux服务配置模式
          • 3、Semanage命令
          • 4、Semanage命令中常用的参数以及作用
        • 四、个人用户主页功能
          • 1、开启主页功能
          • 2、在用户家目录中配置相关文件
          • 3、重启服务
          • 4、访问网站
          • 5、修改SELinux策略规则
          • 6、重启服务
          • 7、访问网站
          • 8、生成密码数据库
          • 9、编辑用户主页的配置文件
          • 10、重启服务
          • 11、访问网站
        • 五、虚拟网站主机功能
          • 1、基于IP地址
            • (1)、编辑网卡
            • (2)、重启网卡
            • (3)、创建网站目录并编辑首页文件
            • (4)、编辑配置文件
            • (5)、设置SELinux
            • (6)、重启服务
            • (7)、访问网站
          • 2、基于主机域名
            • (1)、编辑hosts文件
            • (2)、创建目录并编辑网站首页内容
            • (3)、编辑配置文件
            • (4)、设置SELinux
            • (5)、重启服务
            • (6)、访问网站
          • 2、基于端口号
            • (1)、创建目录并编辑网站首页
            • (2)、添加端口
            • (3)、设置SELinux
            • (4)、查询过滤所有与HTTP协议并且SELinux服务允许的端口列表
            • (5)、手动添加端口并重启服务
            • (6)、访问网站
        • 六、Apache的访问控制
          • 1、创建目录并编辑网站首页
          • 2、编辑配置文件
          • 3、重启服务
          • 4、访问网站

第八章 使用Apache服务部署静态网站

一、网站服务程序

1、网站服务介绍

网站服务就是指Web网络服务,一般是只允许用户通过浏览器访问到互联网中各种资源的服务。Web网络服务是一种被动访问的服务程序,即只有接收到互联网中其他主机发出的请求后才会响应,最终用于提供服务程序的Web服务器,会通过HTTP(超文本传输协议)或者HTTPS(安全超文本传输协议)把请求的内容传送给用户。

2、Apache程序介绍

Apache程序是目前拥有很高市场占有率的Web服务程序之一其跨平台和安全性广泛被认可且拥有快速、可靠、简单的API扩展。Apache服务程序可以运行在Linux系统、Unix系统甚至是Windows系统中,支持基于IP、域名和端口号的虚拟主机功能,支持多种认证方式,集成有代理服务器模块、安全Socket层(SSL),能够实时监视服务状态与定制日志消息,并有着各类丰富的模块支持。

二、配置服务文件参数

1、Linux系统中的配置文件
文件名称作用
/etc/httpd服务目录
/etc/httpd/conf/httpd.conf主配置文件
/var/www/html网站数据目录
/var/log/httpd/access_log访问日志
/var/log/httpd/error_log错误日志
2、配置httpd服务程序时最常用的参数以及用途描述
参数作用
ServerRoot服务目录
ServerAdmin管理员邮箱
User运行服务的用户
Group运行服务的用户组
ServerName网站服务器的域名
DocumentRoot网站数据目录
Listen监听的IP地址和端口号
DirectoryIndex默认的索引页页面
ErrorLog错误日志文件
CustomLog访问日志文件
Timeout网页超时时间,默认为300秒

三、SELinux安全子系统

1、SELinux介绍

SELinux(Security-Enhanced Linux)是美国国家安全局在Linux开源社区的帮助下开发的一个强制访问控制(MAC,Mandatory Access Control)的安全子系统。Linux系统使用SELinux技术的目的是为了让各个服务进程都受到约束,使其仅获取到本应获取的资源。

2、SELinux服务配置模式
第一种:enforcing:强制启用安全策略模式,将拦截服务的不合法请求。
第二种:permissive:遇到服务越权访问时,只发出警告而不强制拦截。
第三种:disabled:对于越权的行为不警告也不拦截
3、Semanage命令

semanage命令用于管理SELinux的策略,英文全称为:“SELinux manage”。

语法格式:semanage [参数] [文件]
4、Semanage命令中常用的参数以及作用
参数作用
-l查询
-a添加
-m修改
-d删除

四、个人用户主页功能

1、开启主页功能
//第17行添加井号(#)
//第24行去掉井号(#)
[root@centos ~]# vim /etc/httpd/conf.d/userdir.conf 
1 #
2 # UserDir: The name of the directory that is appended onto a user's home
3 # directory if a ~user request is received.
4 #
5 # The path to the end user account 'public_html' directory must be
6 # accessible to the webserver userid.  This usually means that ~userid
7 # must have permissions of 711, ~userid/public_html must have permissions
8 # of 755, and documents contained therein must be world-readable.
9 # Otherwise, the client will only receive a "403 Forbidden" message.
10 #
11 <IfModule mod_userdir.c>
12     #
13     # UserDir is disabled by default since it can confirm the presence
14     # of a username on the system (depending on home directory
15     # permissions).
16     #
17     # UserDir disabled
18 
19     #
20     # To enable requests to /~user/ to serve the user's public_html
21     # directory, remove the "UserDir disabled" line above, and uncomment
22     # the following line instead:
23     # 
24     UserDir public_html
25 </IfModule>
26 
27 #
28 # Control access to UserDir directories.  The following is an example
29 # for a site where these directories are restricted to read-only.
30 #
31 <Directory "/home/*/public_html">
32     AllowOverride FileInfo AuthConfig Limit Indexes
33     Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
34     Require method GET POST OPTIONS
35 </Directory>
2、在用户家目录中配置相关文件
//切换普通用户
[root@centos ~]# su - centos 
//创建目录
[centos@centos ~]$ mkdir pubic_html
//编辑网站首页内容
[centos@centos ~]$ echo "Welcome to my website!" > pubic_html/index.html
//家目录权限为755,保证其他用户也有quanx
[centos@centos ~]$ chmod 775 /home/centos/
3、重启服务
//退出普通用户登录
[centos@centos ~]$ exit
注销
//重启httpd服务程序
[root@centos ~]# systemctl restart httpd.service 
4、访问网站
http://192.168.2.22/~centos

在这里插入图片描述

5、修改SELinux策略规则
[root@centos ~]# setsebool -P httpd_enable_homedirs on
6、重启服务
[root@centos ~]# systemctl restart httpd
7、访问网站
http://192.168.2.22/~centos

在这里插入图片描述

8、生成密码数据库
[root@centos ~]# htpasswd -c /etc/httpd/passwd centos
New password: 	//密码
Re-type new password: 	//重新输入密码
Adding password for user centos
9、编辑用户主页的配置文件
[root@centos ~]# vim /etc/httpd/conf.d/userdir.conf 
1 #
2 # UserDir: The name of the directory that is appended onto a user's home
3 # directory if a ~user request is received.
4 #
5 # The path to the end user account 'public_html' directory must be
6 # accessible to the webserver userid.  This usually means that ~userid
7 # must have permissions of 711, ~userid/public_html must have permissions
8 # of 755, and documents contained therein must be world-readable.
9 # Otherwise, the client will only receive a "403 Forbidden" message.
10 #
11 <IfModule mod_userdir.c>
12     #
13     # UserDir is disabled by default since it can confirm the presence
14     # of a username on the system (depending on home directory
15     # permissions).
16     #
17     # UserDir disabled
18 
19     #
20     # To enable requests to /~user/ to serve the user's public_html
21     # directory, remove the "UserDir disabled" line above, and uncomment
22     # the following line instead:
23     # 
24     UserDir public_html
25 </IfModule>
26 
27 #
28 # Control access to UserDir directories.  The following is an example
29 # for a site where these directories are restricted to read-only.
30 #
31 <Directory "/home/*/public_html">
32    AllowOverride all
33    authuserfile "/etc/httpd/passwd"
34    authname "My privately website"
35    authtype basic
36    require user centos
37 </Directory>
10、重启服务
[root@centos ~]# systemctl restart httpd
11、访问网站
http://192.168.2.22/~centos/

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

五、虚拟网站主机功能

1、基于IP地址
(1)、编辑网卡
[root@centos ~]# nmtui

在这里插入图片描述

(2)、重启网卡
[root@centos ~]# nmcli connection up ens160 
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/4
(3)、创建网站目录并编辑首页文件
//创建网站目录
[root@centos ~]# mkdir -p /home/wwwroot/10
[root@centos ~]# mkdir -p /home/wwwroot/20
[root@centos ~]# mkdir -p /home/wwwroot/30
//编辑网站首页文件
[root@centos ~]# echo "IP:192.168.2.10" > /home/wwwroot/10/index.html
[root@centos ~]# echo "IP:192.168.2.20" > /home/wwwroot/20/index.html
[root@centos ~]# echo "IP:192.168.2.30" > /home/wwwroot/30/index.html
(4)、编辑配置文件
[root@centos ~]# vim /etc/httpd/conf/httpd.conf 
133 <VirtualHost 192.168.2.10>
134     DocumentRoot /home/wwwroot/10
135     ServerName www.aaa.com
136     <Directory /home/wwwroot/10>
137     AllowOverride None
138     Require all granted
139     </Directory>
140 </VirtualHost>
141 
142 <VirtualHost 192.168.2.20>
143     DocumentRoot /home/wwwroot/20
144     ServerName www.bbb.com
145     <Directory /home/wwwroot/20>
146     AllowOverride None
147     Require all granted
148     </Directory>
149 </VirtualHost>
150 
151 <VirtualHost 192.168.2.30>
152     DocumentRoot /home/wwwroot/30
153     ServerName www.ccc.com
154     <Directory /home/wwwroot/30>
155     AllowOverride None
156     Require all granted
157     </Directory>
158 </VirtualHost>
(5)、设置SELinux
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/10
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/10/*
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/20
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/20/*
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/30
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/30/*
[root@centos ~]# restorecon -Rv /home/wwwroot/
Relabeled /home/wwwroot from unconfined_u:object_r:user_home_dir_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /home/wwwroot/10 from unconfined_u:object_r:user_home_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /home/wwwroot/10/index.html from unconfined_u:object_r:user_home_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /home/wwwroot/20 from unconfined_u:object_r:user_home_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /home/wwwroot/20/index.html from unconfined_u:object_r:user_home_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /home/wwwroot/30 from unconfined_u:object_r:user_home_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
Relabeled /home/wwwroot/30/index.html from unconfined_u:object_r:user_home_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
(6)、重启服务
[root@centos ~]# systemctl restart httpd.service 
(7)、访问网站
http://192.168.2.10/
http://192.168.2.20/
http://192.168.2.30/

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

2、基于主机域名
(1)、编辑hosts文件
[root@centos ~]# vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.10 www.aaa.com
192.168.2.20 www.bbb.com
192.168.2.30 www.ccc.com
(2)、创建目录并编辑网站首页内容
//创建目录
[root@centos ~]# mkdir -p /home/wwwroot/aaa
[root@centos ~]# mkdir -p /home/wwwroot/bbb
[root@centos ~]# mkdir -p /home/wwwroot/ccc
//编辑网站首页内容
[root@centos ~]# echo "www.aaa.com" > /home/wwwroot/aaa/index.html
[root@centos ~]# echo "www.bbb.com" > /home/wwwroot/bbb/index.html
[root@centos ~]# echo "www.ccc.com" > /home/wwwroot/ccc/index.html
(3)、编辑配置文件
[root@centos ~]# vim /etc/httpd/conf/httpd.conf 
133 <VirtualHost 192.168.2.10>
134     DocumentRoot /home/wwwroot/aaa
135     ServerName www.aaa.com
136     <Directory /home/wwwroot/aaa>
137     AllowOverride None
138     Require all granted
139     </Directory>
140 </VirtualHost>
141 
142 <VirtualHost 192.168.2.20>
143     DocumentRoot /home/wwwroot/bbb
144     ServerName www.bbb.com
145     <Directory /home/wwwroot/bbb>
146     AllowOverride None
147     Require all granted
148     </Directory>
149 </VirtualHost>
150 
151 <VirtualHost 192.168.2.30>
152     DocumentRoot /home/wwwroot/ccc
153     ServerName www.ccc.com
154     <Directory /home/wwwroot/ccc>
155     AllowOverride None
156     Require all granted
157     </Directory>
158 </VirtualHost>
(4)、设置SELinux
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/aaa
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/aaa/*
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/bbb
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/bbb/*
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/ccc
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/ccc/*
[root@centos ~]# restorecon -Rv /home/wwwroot/
(5)、重启服务
[root@centos ~]# systemctl restart httpd.service 
(6)、访问网站
http://192.168.2.10/
http://www.aaa.com/
http://192.168.2.20/
http://www.bbb.com/
http://192.168.2.30/
http://www.ccc.com/

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

2、基于端口号
(1)、创建目录并编辑网站首页
//创建目录
[root@centos ~]# mkdir -p /home/wwwroot/6111
[root@centos ~]# mkdir -p /home/wwwroot/6222
[root@centos ~]# mkdir -p /home/wwwroot/6333
//编辑网站首页
[root@centos ~]# echo "port:6111" > /home/wwwroot/6111/index.html
[root@centos ~]# echo "port:6222" > /home/wwwroot/6222/index.html
[root@centos ~]# echo "port:6333" > /home/wwwroot/6333/index.html
(2)、添加端口
[root@centos ~]# vim /etc/httpd/conf/httpd.conf 45 Listen 8046 Listen 611147 Listen 622248 Listen 6333
135 <VirtualHost 192.168.2.10:6111>
136     DocumentRoot /home/wwwroot/6111
137     ServerName www.aaa.com
138     <Directory /home/wwwroot/6111>
139     AllowOverride None
140     Require all granted
141     </Directory>
142 </VirtualHost>
143 
144 <VirtualHost 192.168.2.20:6222>
145     DocumentRoot /home/wwwroot/6222
146     ServerName www.bbb.com
147     <Directory /home/wwwroot/6222>
148     AllowOverride None
149     Require all granted
150     </Directory>
151 </VirtualHost>
152 
153 <VirtualHost 192.168.2.30:6333>
154     DocumentRoot /home/wwwroot/6333
155     ServerName www.ccc.com
156     <Directory /home/wwwroot/6333>
157     AllowOverride None
158     Require all granted
159     </Directory>
160 </VirtualHost>
(3)、设置SELinux
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/6111
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/6111/*
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/6222
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/6222/*
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/6333
[root@centos ~]# semanage fcontext -a -t httpd_sys_content_t /home/wwwroot/6333/*
[root@centos ~]# restorecon -Rv /home/wwwroot/
(4)、查询过滤所有与HTTP协议并且SELinux服务允许的端口列表
[root@centos ~]# semanage port -l | grep http
http_cache_port_t              tcp      8080, 8118, 8123, 10001-10010
http_cache_port_t              udp      3130
http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t            tcp      5988
pegasus_https_port_t           tcp      5989
(5)、手动添加端口并重启服务
//添加端口
[root@centos ~]# semanage port -a -t http_port_t -p tcp 6111
[root@centos ~]# semanage port -a -t http_port_t -p tcp 6222
[root@centos ~]# semanage port -a -t http_port_t -p tcp 6333
//重启服务
[root@centos ~]# systemctl restart httpd.service 
(6)、访问网站
http://192.168.2.10:6111/
http://192.168.2.20:6222/
http://192.168.2.30:6333/

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

六、Apache的访问控制

1、创建目录并编辑网站首页
[root@centos ~]# mkdir /var/www/html/server
[root@centos ~]# echo "Successful" > /var/www/html/server/index.html
2、编辑配置文件
[root@centos ~]# vim /etc/httpd/conf/httpd.conf 
162 <Directory "/var/www/html/server">
163     SetEnvIf User-Agent "Firefox" ff=1
164     Order allow,deny
165     Allow from env=ff
166 </Directory>
3、重启服务
[root@centos ~]# systemctl restart httpd.service 
4、访问网站
http://192.168.2.10/server/

在这里插入图片描述

相关文章:

第八章 使用Apache服务部署静态网站

文章目录 第八章 使用Apache服务部署静态网站一、网站服务程序1、网站服务介绍2、Apache程序介绍 二、配置服务文件参数1、Linux系统中的配置文件2、配置httpd服务程序时最常用的参数以及用途描述 三、SELinux安全子系统1、SELinux介绍2、SELinux服务配置模式3、Semanage命令4、…...

Three——四、几何体、高光网络材质、锯齿模糊以及GUI库的使用

文章&#xff1a; Three——一、初识Three以及基础的前端场景搭建(结尾含源码)Three——二、加强对三维空间的认识Three——三、动画执行、画布大小、渲染帧率和相机适配体验Three——四、几何体、高光网络材质、锯齿模糊以及GUI库的使用Three——五、点线模型对象、三角形概念…...

盲目自学网络安全只会成为脚本小子?

前言&#xff1a;我们来看看怎么学才不会成为脚本小子 目录&#xff1a; 一&#xff0c;怎么入门&#xff1f; 1、Web 安全相关概念&#xff08;2 周&#xff09;2、熟悉渗透相关工具&#xff08;3 周&#xff09;3、渗透实战操作&#xff08;5 周&#xff09;4、关注安全圈动…...

文从字顺|程序员须知,如何编写高质量代码

高质量代码是软件开发中至关重要的一部分。高质量的代码不仅可以提高软件的可维护性和可复用性&#xff0c;还可以增强软件的安全性和稳定性。同时&#xff0c;可以降低软件维护成本&#xff0c;提升开发效率&#xff0c;为用户提供更好的使用体验。 写出高质量代码是每个程序…...

PCIe物理层弹性缓存机制(详细)解析-PCIe专题知识(四)

目录 前言一、简介二、详细解析2.1 实例解析2.2 具体实现过程 三、总结四、其他相关链接1、PCI总线及发展历程总结2、PCIe物理层总结-PCIE专题知识&#xff08;一&#xff09;3、PCIe数据链路层图文总结-PCIe专题知识&#xff08;二&#xff09;4、PCIe物理层链路训练和初始化总…...

分片上传和断点续传的区别?实现思路是什么?

相同&#xff1a; 分片上传和断点续传都是网络传输中常用的重要技术 不同&#xff1a; 分片上传&#xff1a;将一个大文件切分为多个小文件进行上传。这种方式能够加快上传速度&#xff0c;降低服务器压力&#xff0c;特别适用于大型文件的上传。例如&#xff0c;在云存储系统…...

微前端 qiankun@2.10.5 源码分析(二)

微前端 qiankun2.10.5 源码分析&#xff08;二&#xff09; 我们继续上一节的内容。 loadApp 方法 找到 src/loader.ts 文件的第 244 行&#xff1a; export async function loadApp<T extends ObjectType>(app: LoadableApp<T>,configuration: FrameworkConfi…...

08异步请求:何种场景下应该使用异步请求?

异步在计算机科学中早就是一个比较常用的词汇,从操作系统的特性( 并发、共享、虚拟、异步)开始,异步就在处理并发操作中起到很大的作用,不仅如此,在软件层面,异步同样也是解决并发请求的一个关键过程,它可以将瞬时激增的请求进行更加灵活的处理,通过异步请求,客户端可…...

【深度学习 | Transformer】Transformers 教程:pipeline一键预测

文章目录 一、前言二、Computer vision2.1 Image classification2.2 Object detection2.3 Image segmentation2.4 Depth estimation 三、NLP3.1 Text classification3.2 Token classification3.3 Question answering3.4 Summarization3.5 Translation3.6 Language modeling3.6.…...

HTMLCSS

1、HTML 1.1 介绍 HTML 是一门语言&#xff0c;所有的网页都是用HTML 这门语言编写出来的&#xff0c;也就是HTML是用来写网页的&#xff0c;像京东&#xff0c;12306等网站有很多网页。 这些都是网页展示出来的效果。而HTML也有专业的解释 HTML(HyperText Markup Language)…...

【安装Nginx】

Linux上安装Nginx 文章目录 Linux上安装NginxUbuntuCentOS查看已安装的软件 Ubuntu 在 Ubuntu 上安装 Nginx 非常简单。只需按照以下步骤操作&#xff1a; 打开终端&#xff0c;更新软件包索引&#xff1a; sudo apt update安装 Nginx&#xff1a; sudo apt install nginx安…...

VSCode作业1:猜数字游戏和简单计数器(包含完整代码)

目录 猜数字游戏 一、使用‘random’函数获取随机数 二、 分情况讨论输入值大小情况 三、HTML代码 四、CSS样式及运行效果 简单计数器&#xff08;计时器&#xff09; 一、使用‘setInterval’函数实现计数效果 二、使用’clearInterval‘函数实现暂停计数和重新计数效果 …...

NANK OE骨传导开放式蓝牙耳机发布,极致体验拉满!

近日&#xff0c;中国专业音频品牌NANK南卡发布了全新一代——骨传导开放式蓝牙耳机NANK OE&#xff0c;耳机采用了传统真无线和骨传导的结合方式&#xff0c;带来更加舒适的佩戴体验和音质升级&#xff0c;同时还支持单双耳自由切换&#xff0c;全新的设计收获了市场的喜爱和认…...

看完这篇文章你就彻底懂啦{保姆级讲解}-----(I.MX6U驱动GPIO中断《包括时钟讲解》) 2023.5.9

目录 前言整体文件结构源码分析&#xff08;保姆级讲解&#xff09;中断初始化部分初始化GIC控制器初始化中断向量表设置中断向量表偏移 系统时钟初始化部分使能所有的时钟部分led初始化部分beep初始化部分key初始化部分按键中断初始化部分按键中断服务函数部分 while循环部分 …...

MySql -- 事务

目录 1.概念 2.事务的运用场景 3.事务的四大特点 4.执行事务带来的问题 4.1 脏读 4.2 不可重复度 4.3 幻读 5. MySQL中事务的隔离级别 1.概念 事务就是把若干个独立操作打包成一个整体而诞生的一种功能. 2.事务的运用场景 比如&#xff1a;A——>B 转账500 A的余额-500…...

关于大模型对未来影响的一点看法

人们总是高估了未来一到两年的变化&#xff0c;低估了未来十年的变革。 ---比尔盖茨 近来OpenAI的GPT技术可以说在全球都带来了巨大的影响&#xff0c;也让大家看到了什么叫大力出奇迹。chatGPT和GPT4的能力给了大家很大的震撼&#xff0c;其流畅自如、逻辑清晰、出众的能力&am…...

Android - 约束布局 ConstraintLayout

一、概念 解决布局嵌套过多的问题&#xff0c;采用方向约束的方式对控件进行定位。 二、位置约束 2.1 位置 至少要保证水平和垂直方向都至少有一个约束才能确定控件的位置。 layout_constraintLeft_toLeftOf我的左边&#xff0c;与XXX左边对齐。layout_constraintLeft_toRight…...

Addictive Multiplicative in NN

特征交叉是特征工程中的重要环节&#xff0c;在以表格型&#xff08;或结构化&#xff09;数据为输入的建模中起到了很关键的作用。 特征交互的作用&#xff0c;一是尽可能挖掘对目标有效的模式、特征&#xff0c;二是具有较好的可解释性&#xff0c;三是能够将对数据的洞见引…...

LeetCode 1206. 实现跳表

不使用任何库函数&#xff0c;设计一个跳表。 跳表是在 O(log(n)) 时间内完成增加、删除、搜索操作的数据结构。跳表相比于树堆与红黑树&#xff0c;其功能与性能相当&#xff0c;并且跳表的代码长度相较下更短&#xff0c;其设计思想与链表相似。 例如&#xff0c;一个跳表包…...

离散数学_九章:关系(2)

9.2 n元关系及其应用 1、n元关系&#xff0c;关系的域&#xff0c;关系的阶2、数据库和关系 1. 数据库 2. 主键 3. 复合主键 3、n元关系的运算 1. 选择运算 (Select) 2. 投影运算 (Project) 3. 连接运算 (Join) n元关系&#xff1a;两个以上集合的元素间的关系 1、n元关系…...

KubeSphere 容器平台高可用:环境搭建与可视化操作指南

Linux_k8s篇 欢迎来到Linux的世界&#xff0c;看笔记好好学多敲多打&#xff0c;每个人都是大神&#xff01; 题目&#xff1a;KubeSphere 容器平台高可用&#xff1a;环境搭建与可视化操作指南 版本号: 1.0,0 作者: 老王要学习 日期: 2025.06.05 适用环境: Ubuntu22 文档说…...

【Axure高保真原型】引导弹窗

今天和大家中分享引导弹窗的原型模板&#xff0c;载入页面后&#xff0c;会显示引导弹窗&#xff0c;适用于引导用户使用页面&#xff0c;点击完成后&#xff0c;会显示下一个引导弹窗&#xff0c;直至最后一个引导弹窗完成后进入首页。具体效果可以点击下方视频观看或打开下方…...

JavaSec-RCE

简介 RCE(Remote Code Execution)&#xff0c;可以分为:命令注入(Command Injection)、代码注入(Code Injection) 代码注入 1.漏洞场景&#xff1a;Groovy代码注入 Groovy是一种基于JVM的动态语言&#xff0c;语法简洁&#xff0c;支持闭包、动态类型和Java互操作性&#xff0c…...

MODBUS TCP转CANopen 技术赋能高效协同作业

在现代工业自动化领域&#xff0c;MODBUS TCP和CANopen两种通讯协议因其稳定性和高效性被广泛应用于各种设备和系统中。而随着科技的不断进步&#xff0c;这两种通讯协议也正在被逐步融合&#xff0c;形成了一种新型的通讯方式——开疆智能MODBUS TCP转CANopen网关KJ-TCPC-CANP…...

c#开发AI模型对话

AI模型 前面已经介绍了一般AI模型本地部署&#xff0c;直接调用现成的模型数据。这里主要讲述讲接口集成到我们自己的程序中使用方式。 微软提供了ML.NET来开发和使用AI模型&#xff0c;但是目前国内可能使用不多&#xff0c;至少实践例子很少看见。开发训练模型就不介绍了&am…...

selenium学习实战【Python爬虫】

selenium学习实战【Python爬虫】 文章目录 selenium学习实战【Python爬虫】一、声明二、学习目标三、安装依赖3.1 安装selenium库3.2 安装浏览器驱动3.2.1 查看Edge版本3.2.2 驱动安装 四、代码讲解4.1 配置浏览器4.2 加载更多4.3 寻找内容4.4 完整代码 五、报告文件爬取5.1 提…...

精益数据分析(97/126):邮件营销与用户参与度的关键指标优化指南

精益数据分析&#xff08;97/126&#xff09;&#xff1a;邮件营销与用户参与度的关键指标优化指南 在数字化营销时代&#xff0c;邮件列表效度、用户参与度和网站性能等指标往往决定着创业公司的增长成败。今天&#xff0c;我们将深入解析邮件打开率、网站可用性、页面参与时…...

如何在网页里填写 PDF 表格?

有时候&#xff0c;你可能希望用户能在你的网站上填写 PDF 表单。然而&#xff0c;这件事并不简单&#xff0c;因为 PDF 并不是一种原生的网页格式。虽然浏览器可以显示 PDF 文件&#xff0c;但原生并不支持编辑或填写它们。更糟的是&#xff0c;如果你想收集表单数据&#xff…...

C++使用 new 来创建动态数组

问题&#xff1a; 不能使用变量定义数组大小 原因&#xff1a; 这是因为数组在内存中是连续存储的&#xff0c;编译器需要在编译阶段就确定数组的大小&#xff0c;以便正确地分配内存空间。如果允许使用变量来定义数组的大小&#xff0c;那么编译器就无法在编译时确定数组的大…...

【C++特殊工具与技术】优化内存分配(一):C++中的内存分配

目录 一、C 内存的基本概念​ 1.1 内存的物理与逻辑结构​ 1.2 C 程序的内存区域划分​ 二、栈内存分配​ 2.1 栈内存的特点​ 2.2 栈内存分配示例​ 三、堆内存分配​ 3.1 new和delete操作符​ 4.2 内存泄漏与悬空指针问题​ 4.3 new和delete的重载​ 四、智能指针…...