Nginx实验

news2024/9/23 21:28:19

编译安装 Nginx

准备rhel9环境

下载安装包nginx-1.24.0(xftp)/复制下载链接 (nginx.org——>download)

解压

[root@nginx nginx-1.24.0]# tar zxf nginx-1.24.0.tar.gz 

[root@nginx nginx-1.24.0]#tar zxf nginx-1.24.0.tar.gz 

[root@nginx nginx-1.24.0]#  dnf install gcc pcre-devel zlib-devel openssl-devel -y

[root@nginx nginx-1.24.0]#  useradd -s /sbin/nologin -M nginx
[root@nginx nginx-1.24.0]# ./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_module 

会生成一个Makefile

make clean 可以删掉Makefile 不写!!!!!

重新执行[root@nginx nginx-1.24.0]# ./configure --prefix=/usr/local/nginx ......才有Makefile

[root@nginx nginx-1.24.0]# make -j2(内核有2个就写2)会导致内核溢出!!!!不写

[root@nginx nginx-1.24.0]# vim auto/cc/gcc

/debug,注释

重新启动:

root@nginx nginx-1.24.0]# ./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_module

[root@nginx ~]# make && make install

[root@nginx ~]# vim ~/.bash_profile

export PATH=$PATH:/usr/local/nginx/sbin

[root@nginx ~]# source ~/.bash_profile

[root@nginx ~]# du -sh /usr/local/nginx/sbin/nginx

平滑升级和回滚案例

下载最新的安装包

[root@nginx ~]# wget https://nginx.org/download/nginx-1.26.2.tar.gz

[root@nginx nginx-1.26.2]# tar zxf echo-nginx-module-0.63.tar.gz

[root@nginx nginx-1.26.2]# tar zxf nginx-1.26.2.tar.gz

[root@nginx nginx-1.26.2]# cd nginx-1.26.2/

多写一句:

[root@nginx nginx-1.26.2]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx 
--add-module=/root/echo-nginx-module-0.63 !!!!
--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_module

[root@nginx nginx-1.26.2]# make

[root@nginx nginx-1.26.2]# cd objs/ [root@nginx objs]# ls

[root@nginx objs]# cd /usr/local/nginx/sbin/

[root@nginx sbin]# ls nginx

[root@nginx sbin]# nginx [root@nginx sbin]# curl -I 172.25.254.100

出现这个问题:curl: (7) Failed to connect to 172.25.254.100 port 80: 拒绝连接
防火墙没关;

[root@nginx sbin]# cp nginx nginx.old [root@nginx sbin]# ls nginx nginx.old

[root@nginx sbin]# \cp -f /root/nginx-1.26.2/objs/nginx /usr/local/nginx/sbin/ [root@nginx sbin]# ll

[root@nginx sbin]# ps aux | grep nginx

root       14509  0.0  0.0   9836   936 ?        Ss   22:46   0:00 nginx: master process nginx
nginx      14510  0.0  0.1  13724  5516 ?        S    22:46   0:00 nginx: worker process
root       14547  0.0  0.0 221680  2392 pts/1    S+   22:50   0:00 grep --color=auto nginx

[root@nginx sbin]# pidof nginx 14510 14509

[root@nginx sbin]# kill -USR2 14509

root       14509  0.0  0.0   9836  2676 ?        Ss   22:46   0:00 nginx: master process nginx
nginx      14510  0.0  0.1  13724  5516 ?        S    22:46   0:00 nginx: worker process
root       14549  0.0  0.1   9872  5888 ?        S    22:52   0:00 nginx: master process nginx
nginx      14550  0.0  0.1  13760  4812 ?        S    22:52   0:00 nginx: worker process
root       14552  0.0  0.0 221680  2308 pts/1    S+   22:52   0:00 grep --color=auto nginx

[root@nginx sbin]# kill -WINCH 14509(回收旧版本)

[root@nginx sbin]# ps aux | grep nginx

root       14509  0.0  0.0   9836  2676 ?        Ss   22:46   0:00 nginx: master process nginx
root       14549  0.0  0.1   9872  5888 ?        S    22:52   0:00 nginx: master process nginx
nginx      14550  0.0  0.1  13760  4812 ?        S    22:52   0:00 nginx: worker process
root       14555  0.0  0.0 221680  2384 pts/1    S+   22:54   0:00 grep --color=auto nginx

[root@nginx sbin]# kill -HUP 14509(激活旧版本)

[root@nginx sbin]# ps aux | grep nginx

root       14509  0.0  0.0   9836  2676 ?        Ss   22:46   0:00 nginx: master process nginx
root       14549  0.0  0.1   9872  5888 ?        S    22:52   0:00 nginx: master process nginx
nginx      14550  0.0  0.1  13760  4812 ?        S    22:52   0:00 nginx: worker process
nginx      14570  0.0  0.1  13724  4868 ?        S    22:56   0:00 nginx: worker process
root       14572  0.0  0.0 221680  2436 pts/1    S+   22:56   0:00 grep --color=auto nginx

[root@nginx sbin]# kill -WINCH 14549(回收旧版本)

[root@nginx sbin]# ps aux | grep nginx

root       14509  0.0  0.0   9836  2676 ?        Ss   22:46   0:00 nginx: master process nginx
root       14549  0.0  0.1   9872  6360 ?        S    22:52   0:00 nginx: master process nginx
nginx      14570  0.0  0.1  13724  4868 ?        S    22:56   0:00 nginx: worker process
root       14574  0.0  0.0 221680  2312 pts/1    S+   22:59   0:00 grep --color=auto nginx

[root@nginx sbin]# ls nginx nginx.old

[root@nginx sbin]# cp nginx nginx.new

[root@nginx sbin]# ls nginx nginx.new nginx.old

[root@nginx sbin]# \cp -f nginx.old nginx

[root@nginx sbin]# ls nginx nginx.new nginx.old

[root@nginx sbin]# ps aux | grep nginx

root       14509  0.0  0.0   9836  2676 ?        Ss   22:46   0:00 nginx: master process nginx
root       14549  0.0  0.1   9872  6360 ?        S    22:52   0:00 nginx: master process nginx
nginx      14570  0.0  0.1  13724  5516 ?        S    22:56   0:00 nginx: worker process
root       14601  0.0  0.0 221680  2432 pts/1    S+   23:02   0:00 grep --color=auto nginx

[root@nginx sbin]# kill -9 14549

[root@nginx sbin]# ps aux | grep nginx

root       14509  0.0  0.0   9836  2676 ?        Ss   22:46   0:00 nginx: master process nginroot       14509  0.0  0.0   9836  2676 ?        Ss   22:46   0:00 nginx: master process nginx
nginx      14570  0.0  0.1  13724  5516 ?        S    22:56   0:00 nginx: worker process
root       14603  0.0  0.0 221680  2344 pts/1    S+   23:03   0:00 grep --color=auto nginx

[root@nginx sbin]# nginx -V

nginx version: nginx/1.24.0

[root@nginx sbin]# ls nginx nginx.new nginx.old [root@nginx sbin]# nginx -s stop [root@nginx sbin]# ls nginx nginx.new nginx.old [root@nginx sbin]# rm -fr nginx [root@nginx sbin]# ls nginx.new nginx.old [root@nginx sbin]# mv nginx.new nginx [root@nginx sbin]# ls nginx nginx.old [root@nginx sbin]# nginx(启动服务)

[root@nginx sbin]# nginx -V

nginx version: nginx/1.26.2

[root@nginx sbin]# nginx -t(检查配置文件问题)

nginx服务的启动脚本

[root@nginx sbin]# vim /lib/systemd/system/nginx.service

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target

[root@nginx sbin]# systemctl daemon-reload

[root@nginx sbin]# nginx -s stop

[root@nginx sbin]# ps aux | grep nginx

root       14665  0.0  0.0 221680  2308 pts/1    S+   23:25   0:00 grep --color=auto nginx

[root@nginx sbin]# systemctl enable --now nginx

[root@nginx sbin]# ps aux | grep nginx

root       14691  0.0  0.0   9872   948 ?        Ss   23:26   0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx      14692  0.0  0.1  13772  4788 ?        S    23:26   0:00 nginx: worker process
root       14694  0.0  0.0 221680  2408 pts/1    S+   23:26   0:00 grep --color=auto nginx

主配置文件:vim /usr/local/nginx/conf/nginx.conf

CPU的核心绑定:

worker_processes 1(auto); #启动工作进程数数量

worker_cpu_affinity 01 10;2核 0001 0010 0100 1000;4核

[root@nginx sbin]# systemctl daemon-reload 重启

#修改pam限制

[root@Nginx ~]# sudo -u nginx ulimit -n

1024

[root@Nginx ~]# vim /etc/security/limits.conf

nginx 		-(soft/hard)		nofile			65535/100000
:wq

[root@Nginx ~]# sudo -u nginx ulimit -a

新建一个 PC web 站点

vim /usr/local/nginx/conf/nginx.conf

events {
    worker_connections  100000;
    use epoll;

}



#gzip  on;
    include "/usr/local/nginx/conf.d/*.conf";(子配置文件)

[root@nginx sbin]# mkdir -p /usr/local/nginx/conf.d

[root@nginx sbin]# vim ~/.vimrc

set ts=4 ai sw=4
:wq

[root@nginx sbin]# vim /usr/local/nginx/conf.d/vhost.conf

server {
	listen 80;
	server_name www.huihui.org;
	root /date/web/html;
	index index.html;
}

[root@nginx sbin]# mkdir -p /date/web/html [root@nginx sbin]# echo www.huihui.org > /date/web/html/index.html

[root@nginx sbin]# nginx -t

[root@nginx sbin]# nginx -s reload

解析:

打开c盘——>Windows——>system32——>drivers——>etc——>hosts——>用记事本打开——>编辑——>保存

[root@nginx sbin]# vim /usr/local/nginx/conf.d/vhost.conf

server {
    listen 80;
    server_name www.huihui.org;
    root /date/web/html;
    index index.html;
    location /test1 {
        root /date/web;
    }
}

[root@nginx sbin]# mkdir /date/web/test1 -p [root@nginx sbin]# echo /date/web/test1 > /date/web/test1/index.html

[root@nginx sbin]# 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@nginx sbin]# nginx -s reload

[root@nginx sbin]# vim /usr/local/nginx/conf.d/vhost.conf

server {
	listen 80;
	server_name www.huihui.org;
	root /date/web/html;
	index index.html;
	location /test1 {
		root /date/web;
	}

	location /test2 {(真实别名)
		alias /date/web/test1;(软链接)

	}

}

[root@nginx sbin]# 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@nginx sbin]# nginx -s reload

location的用法详解

url:www.huihui.org/(uri)test1/

location后面加: = 、~ 、 ~* 、 ^~

= 精确匹配,大小写 敏感;

^~ 以什么开头,不区分大小写;

~ 路径的正则表达式,区分大小写;

~* 路径的正则表达式,不区分大小写;

\ (. * ?识别不了)转义为普通符号

不带符号 #匹配起始于此uri的所有的uri

eg1:location后面什么都不加的

url:www.huihui.org/(uri)test1/

location后面加: = 、~ 、 ~* 、 ^~

= 精确匹配,大小写 敏感;

^~ 以什么开头,不区分大小写;

~ 路径的正则表达式,区分大小写;

~* 路径的正则表达式,不区分大小写;

\ (. * ?识别不了)转义为普通符号

不带符号 #匹配起始于此uri的所有的uri

eg1:location后面什么都不加的

[root@nginx ~]# vim /usr/local/nginx/conf.d/vhost.conf

server {
	listen 80;
	server_name www.huihui.org;
	root /data/web/html;
	index index.html;

	location /test {
		root /data/web;

	}

}

[root@nginx ~]# mkdir /data/web/test -p

[root@nginx ~]# vim /usr/local/nginx/conf.d/vhost.conf

[root@nginx ~]# echo test page > /data/web/test/index.html

[root@nginx ~]# nginx -s reload

eg1:location后面加=

[root@nginx ~]# vim /usr/local/nginx/conf.d/vhost.conf

server {
	listen 80;
	server_name www.huihui.org;
	root /data/web/html;
	index index.html;

	location /test {
		root /data/web;
	}

	location = /test {
		root /data/web;
	}

}

[root@nginx ~]# echo test page > /data/web/test/index.html

[root@nginx ~]# nginx -s reload

匹配案例-优先级

[root@nginx sbin]# vim /usr/local/nginx/conf.d/vhost.conf

server {
    listen 80;
    server_name www.huihui.org;
    root /data/web/html;
    index index.html;

    location = /test {
        root /data/web2;
    }

    location /test {
        root /date/web1;
    }
    
    location ^~ /t{
        root /data/web3;
    }

    location ~ .html$ {
        root /data/web4;
    }
	location ~* .HTML$ {
        root /data/web5;
    }
}
[root@nginx ~]# mkdir /data/web{1..5}/test

echo web1 > /data/web1/test/index.html

echo web2 > /data/web2/test/index.html

echo web3 > /data/web3/test/index.html

echo web4 > /data/web4/test/index.html

echo web5 > /data/web5/test/index.html

[root@nginx ~]# nginx -s reload

优先级排序:

(~*    等于   ~)  > 不带符号  >  ^~  >  =

Nginx用户认证

创建认证文件:

[root@nginx ~]# htpasswd -cm /usr/local/nginx/.htpasswd hui New password: hui Re-type new password: hui Adding password for user hui

[root@nginx ~]# cat /usr/local/nginx/.htpasswd hui:$apr1$50z25W/R$zGQCFyWmjqHogGxYXQX.m.

如果想再添加一个liu 一定把c去掉,不然会覆盖原来的文件

[root@nginx ~]# htpasswd -m /usr/local/nginx/.htpasswd liu New password: liu Re-type new password:liu Adding password for user liu

现在的.htpasswd有两个文件

[root@nginx ~]# cat /usr/local/nginx/.htpasswd hui:$apr1$50z25W/R$zGQCFyWmjqHogGxYXQX.m. liu:$apr1$pfV6eNKz$2INsDl3qPu3zSj9ANmv2O1

how to use?

[root@nginx ~]# mkdir /data/web/hui [root@nginx ~]# echo yhx > /data/web/hui/index.html

[root@nginx ~]# vim /usr/local/nginx/conf.d/vhost.conf

server {
	listen 80;
	server_name www.huihui.org;
	root /data/web/html;
	index index.html;

	location /hui {
		root /data/web;
		auth_basic "login password !!";								#认证
		ayth_basic_user_file "/usr/local/nginx/.htpasswd";			#认证

	}
}

[root@nginx ~]# nginx -s reload

自定义错误页面

[root@nginx ~]# vim /usr/local/nginx/conf.d/vhost.conf

server {
	listen 80;
	server_name www.huihui.org;
	root /data/web/html;
	index index.html;
	error_page 404  /40x.html;

	location /hui {
		root /data/web;
		auth_basic "login password !!";
		auth_basic_user_file "/usr/local/nginx/.htpasswd";
	}
	location = /40x.html{
		root /data/web/errorpage;
		}
}

[root@nginx ~]# mkdir -p /data/web/errorpage

[root@nginx ~]# echo error page > /data/web/errorpage/40x.html

[root@nginx ~]# nginx -s reload

Nginx-自定义日志

[root@nginx ~]# ll /usr/local/nginx/logs/

总用量 24 -rw-r--r-- 1 root root 8542 8月 17 12:52 access.log -rw-r--r-- 1 root root 6777 8月 17 12:52 error.log -rw-r--r-- 1 root root 4 8月 17 09:52 nginx.pid

[root@nginx ~]# mkdir /var/log/huihui.org [root@nginx ~]# vim /usr/local/nginx/conf.d/vhost.conf

server {
	listen 80;
	server_name www.huihui.org;
	root /data/web/html;
	index index.html;
	error_page 404  /40x.html;
	error_log /var/log/huihui.org/error.log;			#自定义日志
	access_log /var/log/huihui.org/access.log;			#自定义日志


	location /hui {
		root /data/web;
		auth_basic "login password !!";
		auth_basic_user_file "/usr/local/nginx/.htpasswd";
	}
	location = /40x.html{
		root /data/web/errorpage;
		}
}

[root@nginx ~]# nginx -s reload

访问:

[C:~]$ curl www.huihui.org % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 15 100 15 0 0 987 0 --:--:-- --:--:-- --:--:-- 2142 www.huihui.org

[root@nginx ~]# cat /var/log/huihui.org/access.log 172.25.254.1 - - [17/Aug/2024:13:05:51 +0800] "GET / HTTP/1.1" 200 15 "-" "curl/8.4.0"

Nginx-检测文件是否存在

如果文件不存在就转到default.html页面

[root@nginx ~]# vim /usr/local/nginx/conf.d/vhost.conf

server {
	listen 80;
	server_name www.huihui.org;
	root /data/web/html;
	index index.html;
	error_page 404  /40x.html;
	error_log /var/log/huihui.org/error.log;
	access_log /var/log/huihui.org/access.log;
	try_files $uri $uri.html $uri/index.html /error/default.html;	#检测有没有文件夹


	location /hui {
		root /data/web;
		auth_basic "login password !!";
		auth_basic_user_file "/usr/local/nginx/.htpasswd";
	}
	location = /40x.html{
		root /data/web/errorpage;
		}
}

[root@nginx ~]# nginx -s reload [root@nginx ~]# mkdir /data/web/html/error [root@nginx ~]# echo error default > /data/web/html/error/default.html

[root@nginx ~]# nginx -s reload

把文件夹都删了,curl 一下

Nginx中的长链接管理

在主配置文件中配置的

[root@nginx ~]# vim /usr/local/nginx/conf/nginx.conf

   #keepalive_timeout  0;
    keepalive_timeout  65 60;				#回客户端的会话保持时间为65s
    keepalive_request  100;					#长连接上所允许请求的资源的最大数量

下载测试工具:

[root@nginx ~]# dnf install telnet -y

[root@nginx ~]# curl -v www.huihui.org
*   Trying 216.40.34.37:80...
* Connected to www.huihui.org (216.40.34.37) port 80 (#0)
> GET / HTTP/1.1
> Host: www.huihui.org
> User-Agent: curl/7.76.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< content-length: 0
< location: http://hoverstatus.com/
< cache-control: no-cache
< Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
< 
* Connection #0 to host www.huihui.org left intact
[root@nginx ~]# telnet www.huihui.org 80
Trying 216.40.34.37...
Connected to www.huihui.org.
Escape character is '^]'.
GET / HTTP/1.1
Host: www.huihui.org

HTTP/1.1 302 Found
content-length: 0
location: http://hoverstatus.com/
cache-control: no-cache
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload

Connection closed by foreign host.

Nginx-下载服务器的设定及优化

创一个文件夹

[root@nginx ~]# mkdir /data/web/download

写入一个数据

[root@nginx ~]# dd if=/dev/zero of=/data/web/download/huifile bs=1M count=100

记录了100+0 的读入 记录了100+0 的写出 104857600字节(105 MB,100 MiB)已复制,0.046372 s,2.3 GB/s

[root@nginx ~]# vim /usr/local/nginx/conf.d/vhost.conf

server {
    listen 80;
    server_name www.huihui.org;
    root /data/web/html;
    index index.html;
    error_page 404  /40x.html;
    error_log /var/log/huihui.org/error.log;
    access_log /var/log/huihui.org/access.log;
    try_files $uri $uri.html $uri/index.html /error/default.html;


    location /hui {
        root /data/web;
        auth_basic "login password !!";
        auth_basic_user_file "/usr/local/nginx/.htpasswd";
    }
    location = /40x.html{
        root /data/web/errorpage;
        }
    location /download {
        root /data/web;
        autoindex on;
    }
}

[root@nginx ~]# nginx -s reload

服务器有时间差;

怎么调整时间?

server {
    listen 80;
    server_name www.huihui.org;
    root /data/web/html;
    index index.html;
    error_page 404  /40x.html;
    error_log /var/log/huihui.org/error.log;
    access_log /var/log/huihui.org/access.log;
    try_files $uri $uri.html $uri/index.html /error/default.html;


    location /hui {
        root /data/web;
        auth_basic "login password !!";
        auth_basic_user_file "/usr/local/nginx/.htpasswd";
    }
    location = /40x.html{
        root /data/web/errorpage;
        }
    location /download {
        root /data/web;
        autoindex on;
        autoinndex_localtime on;		#这个这个
    }
}

autoindex_localtime on; #on表示显示本机时间而非GMT(格林威治)时间,默为为off显示GMT时间
autoindex_exact_size on; #计算文件确切大小(单位bytes),此为默认值,off只显示大概大小(单位kb、mb、gb)
limit_rate 1024k; #限速,默认不限速

Nginx 状态页

[root@nginx ~]# cd /usr//local/nginx/conf.d/

[root@nginx conf.d]# vim status.conf

server {
    listen 80;
    server_name hx.hx.org;		##没做解析到C盘下加进去
    root /data/web/html;
    index index.html;

	location /status {
		stub_status;
		#auth_basic"login"
		#auth_basic_user_file "/use/local/nginx/.htpasswd"		#不能让其他人看
		要么用上一个,要么下面这个
		allow 172.25.254.1;
		deny all;
	}
}

[root@nginx conf.d]# nginx -s reload

打开浏览器

Nginx的数据压缩功能

打开主配置文件

[root@nginx conf.d]# vim /usr/local/nginx/conf/nginx.conf

   gzip  on;
	gzip_comp_level 5;
	gzip_min_length 1k;
	gzip_http_version 1.1;
	gzip_vary on;
	gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/gif image/png;

[root@nginx conf.d]# nginx -t

[root@nginx conf.d]# nginx -s reload

[root@nginx conf.d]# echo hello hxhx > /data/web/html/small.html

[root@nginx conf.d]# du -sh /usr/local/nginx/logs/ [root@nginx conf.d]# cat /usr/local/nginx/logs/access.log > /data/web/html/big.html

怎么检测?

[root@nginx conf.d]# curl --head --compressed 172.25.254.100/small.html

HTTP/1.1 200 OK
Server: nginx/1.26.2
Date: Sat, 17 Aug 2024 08:46:57 GMT
Content-Type: text/html
Content-Length: 11
Last-Modified: Sat, 17 Aug 2024 08:40:55 GMT
Connection: keep-alive
Keep-Alive: timeout=60
ETag: "66c06217-b"
Accept-Ranges: bytes

[root@nginx conf.d]# curl --head --compressed 172.25.254.100/big.htm

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

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

相关文章

yolov8安装教程

一、资源下载 1.下载YOLOv8代码 github:YOLOv8-github gitee:YOLOv8-gitee&#xff08;推荐使用国内的gitee&#xff09; 2.conda、cuda 如果没有安装conda&#xff0c;按照流程安装好conda&#xff0c;还要下载好符合自己电脑版本的CUDA 后续会用。 二、创建conda虚拟环…

C语言典型例题43

《C程序设计教程&#xff08;第四版&#xff09;——谭浩强》 习题3.3 有一个函数&#xff1a;y{x,x<1;2x-1,1≤x≤10;3x-11,x≥10。写程序&#xff0c;输入x&#xff0c;输出y。 代码&#xff1a; //《C程序设计教程&#xff08;第四版&#xff09;——谭浩强》 //习题3.3…

OD C卷 - 传递悄悄话

传递悄悄话 &#xff08;100&#xff09; 给定一个二叉树&#xff0c;节点采用顺序存储&#xff0c;如 i0 表示根节点&#xff0c;2i 1 表示左子树根&#xff0c;2i 2 表示右子树根;每个节点站一个人&#xff0c;节点数值表示由父节点到该节点传递消息需要的时间&#xff1b…

周末休整

我写的东西&#xff0c;不爱看的人可以不看&#xff0c;我是给喜欢我的人写的&#xff0c;不喜欢我的人&#xff0c;我也讨厌她。 今天故意写点教人学坏的东西&#xff0c;因为以前写了很多正能量的东西&#xff0c;虽然阅读量还可以&#xff0c;但当见面聊天之后&#xff0c;…

【CSS】CSS新单位vmin和vmax

通过vmin单位可以自动取视口宽度和高度中较小的那个值&#xff0c;vmax同理。 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1…

百度智能云通用文字识别(标准版)- java.lang.NoSuchFieldError: Companion

需求环境 ORC识别图片信息 参考百度示例 百度智能云API文档通用文字识别 官方示例 package baidu.com;import okhttp3.*; import org.json.JSONObject;import java.io.*;/*** 需要添加依赖* <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->…

8.16-ansible的应用

ansible ansible是基于模块工作的&#xff0c;本身没有批量部署的能力。真正具有批量部署的是ansible所运行的模块&#xff0c;ansible只是提供一种框架。 格式 ansible 主机ip|域名|组名|别名 -m ping|copy|... 参数 1.ping模块 m0 # 查看有没有安装epel ​ [rootm0 ~]#…

在vue3中配置scss

要在 Vue 3 中使用 SCSS&#xff08;Sass 的一个子集&#xff09;&#xff0c;你需要安装相应的依赖&#xff0c;并对项目进行一些配置。下面是详细的步骤&#xff1a; 步骤 1: 安装依赖 首先&#xff0c;你需要安装 sass 和 vue-loader&#xff08;如果你使用的是 Vue CLI&a…

vue 2.x + @vue/cli 4.x开发阶段使用Vite

项目用的是vue 2.x vue/cli 4.x(webpack 4.x)。冷启动项目时耗时较长&#xff0c;达到了2分钟以上。热更新时间也达到了10s以上。严重影响了开发体验和效率。 解决问题的过程中遵循2个原则&#xff1a; 不对会影响原构建流程的代码进行改动&#xff0c;向原Webpack构建兼容。…

加密创投周期进化论:未来或黯淡,但流动性是那道光

加密创投领域的风起云涌&#xff0c;而在2022年后&#xff0c;加密市场逐渐进入“行业阵痛期”&#xff0c;面对熊市的寒冬&#xff0c;整个行业的流动性急剧减少&#xff0c;市场的发展被迫寄希望于“板块轮动”的交替炒作。尽管如此&#xff0c;比特币生态和L2生态的兴起&…

树莓派开发笔记03-树莓派的GPIO口输入检测

github主页&#xff1a;https://github.com/snqx-lqh gitee主页&#xff1a;https://gitee.com/snqx-lqh 本项目github地址&#xff1a;https://github.com/snqx-lqh/RaspberryPiLearningNotes 本项目gitee地址&#xff1a;https://gitee.com/snqx-lqh/RaspberryPiLearningNote…

LLAMA 3.1 论文的见解

这有什么大不了的&#xff1f; LLAMA 3.1 的发布标志着 AI 开发的一个重要里程碑。开源模型首次接近领先的闭源模型的性能水平。这一转变预示着未来开源模型同样有效&#xff0c;任何人都可以灵活地修改和调整它们。马克扎克伯格将此与 Linux 的开源性质进行了比较&#xff0c;…

Mysql原理与调优-如何进行sql优化

1.绪论 本文主要讲解我们如何优化一个sql。优化的过程主要分为3个步骤&#xff0c;找到哪些sql需要被优化&#xff0c;这就需要用到慢sql日志。然后发现慢SQL为什么慢&#xff0c;即当前sql是如何执行的&#xff0c;这就需要用到执行计划。最后才是对sql进行优化&#xff0c;对…

作业帮 TiDB 7.5.x 使用经验

作者&#xff1a; 是我的海 原文来源&#xff1a; https://tidb.net/blog/5f9784d3 近期在使用 TiDB 时遇到的一些小问题的梳理总结&#xff0c;大部分版本都在6.5.6和7.5.2 1、limit 导致的扫描量过大的优化 研发定时任务每天需要扫描大量数据&#xff0c;到时机器网卡被…

26.10 Django Ajax异步提交

1. 表单提交 1.1 表单的作用 表单是Web开发中常见的数据收集方式, 它允许用户通过表单输入数据, 并通过提交操作将这些数据发送到服务器进行处理.表单提交方式主要分为两大类: 传统的同步提交(也称为标准提交)和异步提交(主要通过Ajax实现). 它们在工作方式, 用户体验和数据传…

语音助手Verbi:科技创新的未来

今天&#xff0c;我要向大家介绍一个名为Verbi的语音助手项目。这是一个结合了多种先进技术的模块化语音助手应用程序&#xff0c;能够实现语音到文本、文本生成和文本到语音的全流程处理。通过这个项目&#xff0c;我们可以体验到尖端科技如何改变我们的日常生活。 Verbi的诞…

PHP安全开发

安全开发 PHP 基础 增&#xff1a;insert into 表名(列名 1, 列名 2) value(‘列 1 值 1’, ‘列 2 值 2’); 删&#xff1a;delete from 表名 where 列名 ‘条件’; 改&#xff1a;update 表名 set 列名 数据 where 列名 ‘条件’; 查&#xff1a;select * from 表名 wher…

【STM32 Blue Pill编程】-外部中断配置及使用

外部中断配置及使用 文章目录 外部中断配置及使用1、中断介绍2、STM32中的中断3、硬件准备及接线4、GPIO配置5、代码实现在本文中,我们将介绍如何使用 STM32Cube IDE 中的 HAL 库配置和处理外部中断。 我们将通过一个带有按钮和 LED 的示例来演示这一点。 读完本文后,您将能够…

简单了解JVM执行Java程序的基本流程 | 一次编译,到处运行

前言&#xff1a; Java代码怎么做到一次编译&#xff0c;到处运行的呢&#xff1f;靠JVM&#xff0c;那JVM的执行流程是什么呢&#xff1f; 简单来说&#xff1a;通过Javac编译器将Java源代码编译成字节码&#xff0c;JVM通过类加载器将字节码加载到运行时数据区中&#xff0c;…

C++学习笔记之数据结构

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 一、二叉树1.1 二叉树的遍历1.1.1 深度优先搜索&#xff08;DFS&#xff09;1.1.2 广度优先搜索&#xff08;BFS&#xff09; 1.2 对称性&#xff08;递归法&#x…