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

42、nginx之nginx.conf

nginx----web服务器

一、nginx

http就是apache,在国内很少。

nginx是开源的,是一款高性能,轻量级的web服务软件。

稳定性高,而且版本迭代比较快(修复bug速度比较快,安全性快)

消耗系统资源很低,http的请求并发连接,单台服务器开源支持30000-50000个并发请求。(系统资源全部分配给nginx)

单个节点的nginx一般支持20000个并发。

1.1、nginx的功能:

1、静态文件服务:静态页面,可以直接提高静态文件服务,html css jsp。处理静态页面的响应速度很快,效率很好。

2、代理:正向代理,反向代理。可以实现负载均衡,高可用和故障转移。

3、动态内容处理,nginx并不能直接处理动态请求,可以通过中间件nginx 中间件(php,tomat) mysql把动态请求转发给后端服务器。

4、支持加密的http,https

5、可以实现重定向。

6、虚拟主机,一个nginx可以配置多个域名和站点。

7、nginx自带缓存。

8、性能可以扩展。处理能力可以随时调整。

1.2、nginx的应用场景:

  1. 静态页面

  2. 转发动态请求

  3. 反向代理,负载均衡

  4. 缓存服务

1.3、编译过程中代码解释

./configure --prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \   ##支持https的加密功能ss/tls
--with-http_v2_module \   ##支持http2.0协议--with-http_realip_module \  ##支持nginx获取客户端的真实ip地址
--with-http_stub_status_module \  ##支持nginx获取访问状态信息的功能
--with-http_gzip_static_module \  ##支持页面压缩功能
--with-pcre \                   ##支持prce库
--with-stream \             ##支持4层代理的模块 
--with-stream_ssl_module \   ##支持对tcp连接的加密
--with-stream_realip_module   ##支持从代理协议中获取客户端的真实ip地址

make -j4 && make install #启动四个cpu进行

conf 配置文件目录

html 工作目录 50x.html默认的访问操作打开的页面

index.html默认的访问主页

logs 日志目录 访问和报错日志

sbin nginx的二进制启动脚本

ln -s /usr/local/nginx/sbin/nginx /usr/sbin/ #让系统识别nginx的二进制脚本

1.3.1、nginx的常用命令

nginx -t 检测nginx.conf配置文件的语法是否正确

nginx -v 显示nginx的版本

nginx -V显示版本和配置项

nignx -s 信号 stop 关闭nginx

reload 重新加载nginx,如果更改了配置文件,nginx -s reload 无需重新启动服务。

systemctl daemon-reload

二、课后重新编译安装nginx

rpm -q nginx        ##检查yum是否安装yum -y remove nginx ##有则卸载cd /opt         rz -E
rz waiting to receive.systemctl stop firewalld       ##关闭安全机制
setenforce 0yum -y install gcc pcre-devel openssl-devel zlib-devel openssl  openssl-devel  ##配置编译环境useradd -M -s /sbin/nologin nginx        ##添加程序用户tar -xf nginx-1.22.0.tar.gz       ##源码解压cd /nginx-1.22.0/         ## 进入nginx的文件夹,配置暗转路径,以及相关组件./configure --prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-pcre \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_modulemake -j 4 && make install  ##编译和安装[root@test1 nginx-1.22.0]# cd /usr/local/
[root@test1 local]# ls
bin  etc  games  include  lib  lib64  libexec  nginx  sbin  share  srcchown -R nginx.nginx nginx/    ##更改权限[root@test1 local]# cd nginx
[root@test1 nginx]# ll
总用量 4
drwxr-xr-x. 2 nginx nginx 4096 7月   1 16:04 conf
drwxr-xr-x. 2 nginx nginx   40 7月   1 16:04 html
drwxr-xr-x. 2 nginx nginx    6 7月   1 16:04 logs
drwxr-xr-x. 2 nginx nginx   19 7月   1 16:04 sbin[root@test1 nginx]# cd conf/
[root@test1 conf]# ls
fastcgi.conf            koi-utf             nginx.conf           uwsgi_params
fastcgi.conf.default    koi-win             nginx.conf.default   uwsgi_params.default
fastcgi_params          mime.types          scgi_params          win-utf
fastcgi_params.default  mime.types.default  scgi_params.default
[root@test1 conf]# cd ..
[root@test1 nginx]# ls
conf  html  logs  sbin
[root@test1 nginx]# cd html/
[root@test1 html]# ls
50x.html  index.htmlln -s /usr/local/nginx/sbin/nginx /usr/sbin/  ##做一个软连接,让系统能够识别nginx的指令[root@test1 opt]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successfulvim /lib/systemd/system/nginx.service      ##设置系统控制,系统能对nginx这个软件的运行状态进行控制[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/run/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.targetcd /usr/local/nginx/mkdir run            ##修改nginx的配置文件,把进程文件pid文件的位置指向到设置的位置drwx------. 2 nginx root     6 7月   1 16:14 client_body_temp
drwxr-xr-x. 2 nginx nginx 4096 7月   1 16:04 conf
drwx------. 2 nginx root     6 7月   1 16:14 fastcgi_temp
drwxr-xr-x. 2 nginx nginx   40 7月   1 16:04 html
drwxr-xr-x. 2 nginx nginx   58 7月   1 16:14 logs
drwx------. 2 nginx root     6 7月   1 16:14 proxy_temp
drwxr-xr-x. 2 root  root     6 7月   1 16:24 run
drwxr-xr-x. 2 nginx nginx   19 7月   1 16:04 sbinchown nginx.nginx runcd conf/vim nginx.confpid /usr/local/nginx/run/nginx.pid;nginx -tsystemctl daemon-reloadsystemctl restart nginx

面试题:如果出现了500,怎么来排查这个错误?

1、查看日志

2、查看内部服务器的服务是否启动。

3、查看防火墙的规则配置,是否有限制。

4、查看硬件是否负载过高。

三、nginx.conf

3.1、nginx.conf

1、全局模块

worker_processes 1;--------工作进程数,设置成服务器内核数的2倍(一般不超过8个,超过8个反正会降低性能,4个,1-2个)

#user nobody;------#默认的程序用户就是nginx,这里可以保持注释无需修改

pid /usr/local/nginx/run/nginx.pid;----------#pid文件的位置;

events { worker_connections 1024;}----------#events模块,决定了ngin能够处理的连接数,连接数和worker_connections的数值相乘—1*1024。

处理进程的过程必然涉及配置文件和展示页面,也就是涉及打开文件的数量

linux默认打开的文件就是1024个

vim /etc/security/limits.conf ##进程数量更改

限制先改,进程数量才能生效,默认1024。

*soft nproc 65535----#能打开的进程最大数的软限制是65535

*hard nproc 65535----#能打开的进程最大数的硬限制是65535

*soft nofile 65535-------#软限制进程打开文件数的最大值65535

*hard nofile 65535----------#硬限制进程打开文件数的最大值65535

配置要生效,只能重启,这是系统初始化的一个环节。

在这里插入图片描述

http {
include mime.types;
default_type application/octet-stream;

#http转发和处理http请求,设置代理(正向代理,反向代理),缓存。定义日志格式,重定向配置

include mime.types;------#文件扩展名于文件类型的映射表。nginx能够打开的文件和支持的文件类型。

default_type application/octet-stream;--------------#默认支持的文件类型 。.html .htm .jsp .js .php

 #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';  #日志格式,默认的日志格式,记录了access.log,访问日志的格式,error.log也是一样的格式

#access_log logs/access.log main;-------##默认的访问日志的存放路径

sendfile on;—#支持文件发送和下载

#tcp_nopush on;–#默认就是异步非阻塞模式功能

#keepalive_timeout 0;
keepalive_timeout 65;–#连接保持时间,单位为秒/s。

#gzip on;----#gzip模块,设置是否开启页面压缩功能。

##开启web服务的模块

 server {listen       80;#nginx的默认监听端口server_name  localhost;#配置站点的域名#charset koi8-r;#网页的字符集#access_log  logs/host.access.log  main;
#网页匹配的工作目录的地址和支持的打开页面的文件类型。location /xy102(URI) {root   html(/opt/test1)(URL);
#192.168.168.10/opt/test1/xy102/index.html
#家目录。nginx工作目录的家目录,/usr/local/nginx/html
index  index.html index.htm;}

错误日志位置

tail -f /usr/local/nginx/logs/error.log

在这里插入图片描述

在这里插入图片描述

访问是缓存,清除缓存

在这里插入图片描述

#alisa也是指匹配nginx的工作目录

root 换成 alisa

在这里插入图片描述

在这里插入图片描述

alisa是绝对路径。URL/URI

3.2、root和alias的区别:

root的匹配模式 :拼接

root的工作目录,访问的是uri /xy102

location /xy102;

/opt/test1/

拼接为/opt/test1/xy102

alias匹配nginx的工作目录,路径是绝对路径

location /xy102

alias /opt/test1/xy102/;

alias只能写在http模块当中server模块的location模块里面。

root 可以写在server模块,也可以在http,也可以在location中。

alias匹配工作目录,不能使用重定向功能。

3.3、全局模块

work_processes 1:指定进程数

events:模块决定了能够处理的连接数

stream:四层代理模块

http模块

转发和处理http请求,设置代理(正向代理,反向代理),缓存。定义日志格式,重定向配置

在http模块当中,包含:

server块 http里面可以有多个server模块

在server模块当中包含:

location模块

在server当中可以有多个location。

在这里插入图片描述

实验1:#统计访问状态

Active connections:1 #当前活动的连接数

server accepts handled requests #表示已经处理的连接数

36 36 36 #三个数,从左往右,已经处理的连接数;成功建立连接的次数;已经处理的请求数

Reading:0 writing:1 Waiting:0

Reading:表示服务端正在从客户端读取请求的数据

writing:表示服务端正在把响应数据发送给客户端

Waiting:表示有连接处于空闲状态,等待新的请求。

server里写入统计访问状态

  location /status {stub_status on;#打开状态统计功能access_log off;#关闭status的访问日志;}

访问192.168.168.10/status

结果如下:

在这里插入图片描述

实验2:基于密码的授权进行访问控制

yum -y install httpd-tools #先安装工具

location / 根目录加密

vim nginx.conf

    #access_log  logs/host.access.log  main;location / {root   html;index  index.html index.htm;auth_basic "secret";#开启用户密码验证auth_basic_user_file /usr/local/nginx/passwd.db;#使用指定的加密文件}yum -y install httpd-toolshtpasswd -c /usr/local/nginx/passwd.db dn
[root@test1 nginx]# chown nginx passwd.db 
[root@test1 nginx]# chmod 400 passwd.db

在这里插入图片描述

需要输入设置的用户名和对应设置的密码进行访问

实验3:基于客户端的访问控制 ip地址来进行控制

#添加控制规则

vim /usr/local/nginx/conf/nginx.confdeny 192.168.168.20;allow all;

用192.168.168.20测试结果:

在这里插入图片描述

实验4:基于域名的nginx主机

vim nginx.conf

server {listen       80;server_name  www.xy102.com;charset utf-8;access_log  logs/www.xy102.com.access.log;#access_log  logs/host.access.log  main;location / {root   /var/www/html/xy102;index  index.html index.htm;}#新增加域名访问server {listen       80;server_name  www.ly.com;charset utf-8;access_log  logs/www.ly.com.access.log;#access_log  logs/host.access.log  main;location / {root   /var/www/html/ly;index  index.html index.htm;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}}
vim /etc/hosts----本地映射192.168.168.10 www.xy102.commkdir -p /var/www/html/xy102echo "我们都爱学习" > /var/www/html/xy102/index.htmlcurl www.xy102.com
我们都爱学习192.168.168.10 www.xy102.com www.ly.com
#域名可以用同一个IP地址mkdir -p /var/www/html/lyecho "我真帅" > /var/www/html/ly/index.htmlcurl www.ly.com
我真帅

实验5:基于ip地址的虚拟主机

ifconfig ens33:0 192.168.168.100/24
[root@test1 conf]# ifconfig 
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet 192.168.168.10  netmask 255.255.255.0  broadcast 192.168.168.255inet6 fe80::20c:29ff:fe1a:7434  prefixlen 64  scopeid 0x20<link>ether 00:0c:29:1a:74:34  txqueuelen 1000  (Ethernet)RX packets 10190  bytes 895390 (874.4 KiB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 6728  bytes 886953 (866.1 KiB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0ens33:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500inet 192.168.168.100  netmask 255.255.255.0  broadcast 192.168.168.255ether 00:0c:29:1a:74:34  txqueuelen 1000  (Ethernet)

多个ip地址:

 server {listen      192.168.168.10:80;server_name  www.xy102.com;charset utf-8;access_log  logs/www.xy102.com.access.log;location / {root   /var/www/html/xy102;index  index.html index.htm;}location /xy103 {alias /opt/test1/xy103;index index.html;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}server {listen      192.168.168.100:80;server_name  www.ly.com;charset utf-8;access_log  logs/www.ly.com.access.log;#access_log  logs/host.access.log  main;location / {root   /var/www/html/ly;index  index.html index.htm;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}}

测试结果

在这里插入图片描述

实验6:基于端口实现多个虚拟主机

ifconfig ens33:0 192.168.168.100/24server {listen      192.168.168.10:80;server_name  www.xy102.com;charset utf-8;access_log  logs/www.xy102.com.access.log;location / {root   /var/www/html/xy102;index  index.html index.htm;}location /xy103 {alias /opt/test1/xy103;index index.html;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}server {listen      192.168.168.100:80;server_name  www.ly.com;charset utf-8;access_log  logs/www.ly.com.access.log;#access_log  logs/host.access.log  main;location / {root   /var/www/html/ly;index  index.html index.htm;}​        error_page   500 502 503 504  /50x.html;
location = /50x.html {
​    root   html;
}}

在这里插入图片描述

[root@test1 nginx]# cd logs
[root@test1 logs]# ls
access.log  error.log  www.ly.com.access.log  www.xy102.com.access.log

在这里插入图片描述

实验7:多个配置文件

vim nginx.confinclude /usr/local/nginx/conf.d/*.conf--------##可以识别到conf.d下,只包含server模块的conf文件。把server单独放到一个文件当中去。不在nginx.conf文件当中。
cd /usr/local/nginxmkdir conf.dvim test1.conf

在这里插入图片描述

server {listen      8881;server_name  localhost;charset utf-8;location /test1 {root   /opt/conf;index  index.html index.htm;}
}
server {listen      8882;server_name  localhost;charset utf-8;location /test2 {root   /opt/conf;index  index.html index.htm;}}

mkdir -p /opt/conf/test1

[root@test1 conf.d]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@test1 conf.d]# mkdir -p /opt/conf/test1
[root@test1 conf.d]# echo "wozhenshuai" > /opt/conf/test1/index.html
[root@test1 conf.d]# 
[root@test1 conf.d]# mkdir -p /opt/conf/test2
[root@test1 conf.d]# echo "wozhenchou" > /opt/conf/test2/index.html
[root@test1 conf.d]# netstat -antp | grep nginx
tcp        0      0 192.168.168.10:8080     0.0.0.0:*               LISTEN      15027/nginx: master 
tcp        0      0 192.168.168.10:8081     0.0.0.0:*               LISTEN      15027/nginx: master 

在这里插入图片描述

实验8:nginx优化与防盗链:

[root@test1 conf.d]# curl -I 192.168.168.10:8881/test1/
HTTP/1.1 200 OK
Server: nginx/1.22.0
Date: Tue, 02 Jul 2024 08:27:16 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 12
Last-Modified: Tue, 02 Jul 2024 08:02:36 GMT
Connection: keep-alive
ETag: "6683b41c-c"
Accept-Ranges: bytes
[root@test1 conf]# vim nginx.confserver_tokens off;[root@test1 conf]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@test1 conf]# systemctl restart nginx
[root@test1 conf]# curl -I 192.168.168.10:8881/test1/
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 02 Jul 2024 08:31:42 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 12
Last-Modified: Tue, 02 Jul 2024 08:02:36 GMT
Connection: keep-alive
ETag: "6683b41c-c"
Accept-Ranges: bytes

在这里插入图片描述

隐藏版本号:在/usr/local/nginx/conf/nginx.conf添加server_tokens off;

基于第八个实验拓展

 cd /opt/
[root@test1 opt]# ls
aa  conf  jenkins-2.396-1.1.noarch.rpm  nginx-1.22.0  nginx-1.22.0.tar.gz  test
[root@test1 opt]# cd nginx-1.22.0/
[root@test1 nginx-1.22.0]# ls
auto     CHANGES.ru  configure  html     Makefile  objs    src
CHANGES  conf        contrib    LICENSE  man       README
[root@test1 nginx-1.22.0]# cd src/
[root@test1 src]# ls
core  event  http  mail  misc  os  stream
[root@test1 src]# cd core/
[root@test1 core]# ls[root@test1 core]# vim nginx.h#define NGINX_VERSION      "wozhenshuai"
#define NGINX_VER          "nibiecai/" NGINX_VERSION[root@test1 core]# cd ..
[root@test1 src]# cd ..
[root@test1 nginx-1.22.0]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module[root@test1 nginx-1.22.0]# make -j 4 && make installcd /usr/local/nginx/
[root@test1 nginx]# cd conf
[root@test1 conf]# vim nginx.confserver_tokens on;[root@test1 conf]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@test1 conf]# systemctl restart nginx[root@test1 conf]# curl -I 192.168.168.10:8881/test1/
HTTP/1.1 200 OK
Server: nibiecai/wozhenshuai
Date: Tue, 02 Jul 2024 08:49:31 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 12
Last-Modified: Tue, 02 Jul 2024 08:02:36 GMT
Connection: keep-alive
ETag: "6683b41c-c"
Accept-Ranges: bytes

在这里插入图片描述

相关文章:

42、nginx之nginx.conf

nginx----web服务器 一、nginx http就是apache&#xff0c;在国内很少。 nginx是开源的&#xff0c;是一款高性能&#xff0c;轻量级的web服务软件。 稳定性高&#xff0c;而且版本迭代比较快&#xff08;修复bug速度比较快&#xff0c;安全性快&#xff09; 消耗系统资源…...

高薪程序员必修课-java为什么要用并发编程

目录 前言 1. 提高性能和效率 2. 更好地响应用户 3. 优化I/O操作 具体示例 示例1&#xff1a;提高性能和效率 示例2&#xff1a;更好地响应用户 示例3&#xff1a;优化I/O操作 总结 前言 并发编程允许多个线程在同一时间执行任务。下面我们从多个原理角度来解释为什么J…...

postgreSQL学习

postgreSql学习 学习参考&#xff1a;1、命令1.1 登录1.2 关闭连接 2、常用数据类型2.1 数值类型2.2 字符串类型2.3 时间2.4 其他 3、自增主键4、sql4.1 库操作&#xff08;1&#xff09;创建新库&#xff08;2&#xff09;切换数据库&#xff08;3&#xff09;删库【谨慎&…...

【3】系统标定

文章目录 雷达标定相机主雷达标定底盘动力学标定车辆循迹验证建图 雷达标定 主要是为了获得到lidar到imu的tf关系。imu为父坐标lidar为子坐标。其他雷达标定到主lidar坐标系下。 标定的结果都是生成一个是四元数。 #mermaid-svg-crOWRnT4UE0jtJVy {font-family:"trebuch…...

网安小贴士(3)网安协议

一、前言 网络安全协议是构建安全网络环境的基础&#xff0c;它们帮助保护网络通信免受各种威胁和攻击。 二、定义 网络安全协议是指在计算机网络中用于确保网络通信和数据传输安全的协议。它们定义了在网络通信过程中的安全机制、加密算法、认证和授权流程等&#xff0c;以保…...

大数据面试题之HBase(1)

目录 介绍下HBase HBase优缺点 说下HBase原理 介绍下HBase架构 HBase读写数据流程 HBase的读写缓存 在删除HBase中的一个数据的时候&#xff0c;它什么时候真正的进行删除呢?当你进行删除操作&#xff0c;它是立马就把数据删除掉了吗? HBase中的二级索引 HBa…...

git回退commit的方式

在Git中&#xff0c;回退commit&#xff08;即撤销之前的提交&#xff09;可以通过多种方式来实现。以下是一些常见的方法&#xff0c;以及它们的详细步骤和注意事项&#xff1a; ### 1. 使用git revert命令 git revert命令用于撤销某次commit&#xff0c;但它并不会删除该comm…...

[Information Sciences 2023]用于假新闻检测的相似性感知多模态提示学习

推荐的一个视频&#xff1a;p-tuning P-tunning直接使用连续空间搜索 做法就是直接将在自然语言中存在的词直接替换成可以直接训练的输入向量。本身的Pretrained LLMs 可以Fine-Tuning也可以不做。 这篇论文也解释了为什么很少在其他领域结合知识图谱的原因&#xff1a;就是因…...

自定义vue3 hooks

文章目录 hooks目录结构demo hooks 当页面内有很多的功能&#xff0c;js代码太多&#xff0c;不好维护&#xff0c;可以每个功能都有写一个js或者ts&#xff0c;这样的话&#xff0c;代码易读&#xff0c;并且容易维护&#xff0c;组合式setup写法与此结合&#x1f44d;&#…...

《昇思25天学习打卡营第21天 | 昇思MindSporePix2Pix实现图像转换》

21天 本节学习了通过Pix2Pix实现图像转换。 Pix2Pix是基于条件生成对抗网络&#xff08;cGAN&#xff09;实现的一种深度学习图像转换模型。可以实现语义/标签到真实图片、灰度图到彩色图、航空图到地图、白天到黑夜、线稿图到实物图的转换。Pix2Pix是将cGAN应用于有监督的图…...

【文档+源码+调试讲解】科研经费管理系统

目 录 目 录 摘 要 ABSTRACT 1 绪论 1.1 课题背景 1.2 研究现状 1.3 研究内容 2 系统开发环境 2.1 vue技术 2.2 JAVA技术 2.3 MYSQL数据库 2.4 B/S结构 2.5 SSM框架技术 3 系统分析 3.1 可行性分析 3.1.1 技术可行性 3.1.2 操作可行性 3.1.3 经济可行性 3.1…...

linux 下 rm 为什么要这么写?

下面代码中的rm 为什么要写成/bin/rm? 大文件清理&#xff0c;高宿主含量样本可节约>90%空间/bin/rm -rf temp/qc/*contam* temp/qc/*unmatched* temp/qc/*.fqls -l temp/qc/ 这是一个很好的问题&#xff0c;观察很仔细, 也带着了自己的思考。 rm是 Linux 下的一个危险…...

【Spring Boot】Spring AOP中的环绕通知

目录 一、什么是AOP?二、AOP 的环绕通知2.1 切点以及切点表达式2.2 连接点2.3 通知&#xff08;Advice&#xff09;2.4 切面(Aspect)2.5 不同通知类型的区别2.5.1 正常情况下2.5.2异常情况下 2.6 统一管理切点PointCut 一、什么是AOP? Aspect Oriented Programming&#xff…...

docker部署前端,配置域名和ssl

之前使用80端口部署前端项目后&#xff0c;可以使用IP端口号在公网访问到部署的项目。 进行ICP域名备案后&#xff0c;可以通过域名解析将IP套壳&#xff0c;访问域名直接访问到部署的项目~ 如果使用http协议可以很容易实现这个需求&#xff0c;对nginx.conf文件进行修改&#…...

初学Spring之 IOC 控制反转

Spring 是一个轻量级的控制反转&#xff08;IOC&#xff09;和面向切面编程&#xff08;AOP&#xff09;的框架 导入 jar 包&#xff1a;spring-webmvc、spring-jdbc <dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc&…...

rpc的仅有通信的功能,在网断的情况下,比网通情况下,内存增长会是什么原因

RPC&#xff08;Remote Procedure Call&#xff0c;远程过程调用&#xff09;主要负责在分布式系统中透明地调用远程服务&#xff0c;就像调用本地函数一样。它封装了网络通信的细节&#xff0c;使得开发者可以专注于业务逻辑而非底层通信协议。RPC通信通常包括序列化、网络传输…...

从零开始:如何设计一个现代化聊天系统

写在前面: 此博客内容已经同步到我的博客网站,如需要获得更优的阅读体验请前往https://mainjaylai.github.io/Blog/blog/system/chat-system 在当今数字化时代,聊天系统已成为我们日常生活和工作中不可或缺的一部分。从个人交流到团队协作,从客户服务到社交网络,聊天应用…...

香橙派OrangePi AIpro初体验:当小白拿到一块开发板第一时间会做什么?

文章目录 香橙派OrangePi AIpro初体验&#xff1a;当小白拿到一块高性能AI开发板第一时间会做什么前言一、香橙派OrangePi AIpro概述1.简介2.引脚图开箱图片 二、使用体验1.基础操作2.软件工具分析 三、香橙派OrangePi AIpro.测试Demo1.测试Demo1&#xff1a;录音和播音(USB接口…...

【C语言内存函数】

目录 1.memcpy 使用 模拟实现 2.memmove 使用 模拟实现 3.memset 使用 4.memcmp 使用 1.memcpy 使用 void * memcpy ( void * destination, const void * source, size_t num );目的地址 源地址 字节数 destination&#xff1a;指向要复制内…...

Mysql部署MHA高可用

部署前准备&#xff1a; mysql-8.0.27下载地址&#xff1a;https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.27-1.el7.x86_64.rpm-bundle.tar mha-manager下载地址&#xff1a;https://github.com/yoshinorim/mha4mysql-manager/releases/download/v0.58/mha4mysql-mana…...

【算法学习】射线法判断点在多边形内外(C#)以及确定内外两点连线与边界的交点

1.前言&#xff1a; 在GIS开发中&#xff0c;经常会遇到确定一个坐标点是否在一块区域的内部这一问题。 如果这个问题不是一个单纯的数学问题&#xff0c;例如&#xff1a;在判断DEM、二维图像像素点、3D点云点等含有自身特征信息的这些点是否在一个区域范围内部的时候&#x…...

SQL语句(DML)

DML英文全称是Data Manipulation Language&#xff08;数据操作语言&#xff09;&#xff0c;用来对数据库中表的数据记录进行增删改等操作 DML-添加数据 insert into employee(id, workno, name, gender, age, idcard) values (1,1,Itcast,男,10,123456789012345678);select *…...

uniapp小程序打开地图导航

uniapp uni.getLocation({type: gcj02, //返回可以用于uni.openLocation的经纬度success: function (res) {const latitude res.latitude;const longitude res.longitude;uni.openLocation({latitude: latitude,longitude: longitude,success: function () {console.log(suc…...

webstorm格式化或保存时 vue3引入的组件被删除了

解决办法 保存时设置 格式化设置...

Java时间转换

一、线程不安全 Date date new Date(); SimpleDateFormat dateFormat new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String prefix dateFormat.format(date);二、线程安全,建议使用 String t1 LocalDateTime.now().format(DateTimeFormatter.ofPattern("y…...

Spring Boot与WebFlux的实战案例

Spring Boot与WebFlux的实战案例 大家好&#xff0c;我是免费搭建查券返利机器人省钱赚佣金就用微赚淘客系统3.0的小编&#xff0c;也是冬天不穿秋裤&#xff0c;天冷也要风度的程序猿&#xff01;今天&#xff0c;我们将探讨如何利用Spring Boot和WebFlux构建响应式应用的实战…...

vue3引入本地静态资源图片

一、单张图片引入 import imgXX from /assets/images/xx.png二、多张图片引入 说明&#xff1a;import.meta.url 是一个 ESM 的原生功能&#xff0c;会暴露当前模块的 URL。将它与原生的 URL 构造器 组合使用 注意&#xff1a;填写自己项目图片存放的路径 /** vite的特殊性…...

git 禁止dev合并到任何其他分支

创建 pre-merge-commit 钩子 导航到 Git 仓库的钩子目录&#xff1a; cd /path/to/your/repo/.git/hooks创建或编辑 pre-merge-commit 钩子&#xff1a; 也可以通过指令创建 nano pre-merge-commit在钩子文件中添加以下代码&#xff1a; #!/bin/sh# 获取当前分支名称 curr…...

第二节:如何使用thymeleaf渲染html(自学Spring boot 3.x的第一天)

大家好&#xff0c;我是网创有方&#xff0c;今天来学习如何使用thymeleaf渲染html。该模板运用不广泛&#xff0c;所以本节内容了解既可。 第一步&#xff1a;创建html文件。 在模板templates目录下创建一个html文件。 编写代码如下&#xff1a; <!DOCTYPE html> <…...

计算机相关术语科普之什么叫网关(Gateway)

网关&#xff08;Gateway&#xff09;是一个在计算机网络中起到关键作用的设备或系统&#xff0c;它扮演着网络间连接器或协议转换器的角色。 一、定义与功能 1&#xff09;定义&#xff1a; 网关是在不同网络之间实现互连的复杂设备&#xff0c;仅用于两个高层协议不同的网…...