Nginx 相關實驗(1)

nginx源碼編譯

本實驗采用nginx源碼編譯的安裝方式,需要準備一個tar包,可從nginx官網上下載。

下載地址:nginx: downloadhttps://nginx.org/en/download.html

將下載好的壓縮包傳到虛擬機中的自定義目錄下

[root@webserver ~]# ls
anaconda-ks.cfg  Documents  Music                Pictures  rh9.3.repo  Videos
Desktop          Downloads  nginx-1.24.0.tar.gz  Public    Templates

解壓:

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

解壓后,進入nginx-1.24.0/目錄下可看到以下目錄文件

[root@webserver ~]# cd nginx-1.24.0/
[root@webserver nginx-1.24.0]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src

其中各個目錄作用如下

構建與配置相關

  • auto/
    作用:包含大量用于 configure 腳本的輔助腳本和配置文件。

    • 定義了不同操作系統、編譯器、模塊的檢測邏輯。

    • 比如 auto/cc/ 下是編譯器檢測,auto/modules 是模塊配置。

    • 用戶無需手動修改,由 configure 自動調用。

  • configure
    作用:Nginx 的核心配置腳本(可執行文件)。

    • 運行 ./configure 會檢測系統環境、生成編譯所需的 Makefile

    • 通過參數(如 --prefix--with-http_ssl_module)定制功能。

  • CHANGES
    作用:英文版更新日志,記錄每個版本的功能變更、修復的Bug、新增特性(按版本倒序排列)。

  • CHANGES.ru
    作用:俄文版更新日志(Nginx 作者 Igor Sysoev 是俄羅斯人),內容與 CHANGES 一致,但面向俄語用戶。

  • LICENSE
    作用:Nginx 的許可證文件(2-Clause BSD License),允許自由使用、修改和分發。

  • README
    作用:簡潔的項目介紹,通常包含編譯安裝的快速指南和官方文檔鏈接。

  • man/
    作用:Nginx 的手冊頁(Manual Pages),包含 nginx.8 等文件。

    • 安裝后可通過 man nginx 查看命令行用法。

  • conf/
    作用:存放默認的示例配置文件

    • nginx.conf(主配置)、fastcgi.conf(FastCGI 配置模板)。

    • 安裝時會被復制到 --prefix/conf/(默認 /usr/local/nginx/conf/)。

  • src/
    作用:Nginx 源代碼的核心目錄,按模塊分層:

    • src/core/:核心代碼(如主函數、內存管理)。

    • src/http/:HTTP 模塊(處理 Web 請求)。

    • src/mail/:郵件代理模塊(POP3/IMAP/SMTP)。

    • src/stream/:TCP/UDP 代理模塊(1.9.0+ 新增)。

  • html/
    作用:默認的靜態網頁文件

    • index.html(歡迎頁)和 50x.html(錯誤頁)。

    • 安裝后位于 --prefix/html/,是 Nginx 初始測試時訪問的頁面。

#創建nginx服務使用的用戶
useradd -s /sbin/nologin -M nginx   -s /sbin/nologin為禁止遠程登陸  -M為不創建家目錄#安裝環境所需要的軟件
# dnf install gcc pcre-devel zlib-devel openssl-devel -y
#檢測環境
./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#縮小安裝,在nginx目錄下
cd nginx-1.24.0/
ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  Makefile  man  objs  README  src
vim auto/cc/gcc
# debug
#CFLAGS="$CFLAGS -g"	---將此行注釋掉即可#檢測完畢后編譯
make#安裝編譯完成后的可執行文件和庫文件以及配置文件到指定目錄下
make install

nginx平滑升級和回滾

?平滑升級需要兩個不同版本的nginx包存在

[root@webserver sbin]# curl -I 192.168.75.10	---查看nginx版本
HTTP/1.1 200 OK
Server: nginx/1.24.0
Date: Thu, 24 Jul 2025 02:29:25 GMT
Content-Type: text/html
Content-Length: 14
Last-Modified: Thu, 24 Jul 2025 02:12:36 GMT
Connection: keep-alive
ETag: "68819694-e"
Accept-Ranges: bytes[root@webserver sbin]# cp -p nginx nginx.old	---將24版nginx備份[root@webserver sbin]# ls
nginx  nginx.old[root@webserver sbin]# /bin/cp -f /root/nginx-1.26.1/objs/nginx /usr/local/sbin/nginx	---將26版nginx放到該目錄下[root@webserver sbin]# ps aux | grep nginx	---查看進程
root        2715  0.0  0.0   4416   360 ?        Ss   10:36   0:00 nginx: master                                                                                        process nginx
nobody      2716  0.0  0.2  12624  5172 ?        S    10:36   0:00 nginx: worker                                                                                        process
root        2718  0.0  0.1 221664  2296 pts/0    S+   10:36   0:00 grep --color=                                                                                       auto nginx[root@webserver sbin]# kill -USR2 2715(舊服務master進程號)	---重新加載配置文件、啟用新的工作進程(只啟動進程,不監聽端口),以實現平滑升級而不導致服務中斷。[root@webserver sbin]#
[root@webserver sbin]# ps aux | grep nginx
root        2715  0.0  0.1   4416  1844 ?        Ss   10:36   0:00 nginx: master                                                                                        process nginx
nobody      2716  0.0  0.2  12624  5172 ?        S    10:36   0:00 nginx: worker                                                                                        process
root        2720  0.0  0.1   4420  2516 ?        S    10:36   0:00 nginx: master                                                                                        process nginx
nobody      2721  0.0  0.2  12624  5160 ?        S    10:36   0:00 nginx: worker                                                                                        process
root        2723  0.0  0.1 221664  2296 pts/0    S+   10:36   0:00 grep --color=                                                                                       auto nginx[root@webserver sbin]# kill -WINCH 2715		---回收舊版本進程
[root@webserver sbin]#
[root@webserver sbin]# ps aux | grep nginx
root        2715  0.0  0.1   4416  1844 ?        Ss   10:36   0:00 nginx: master                                                                                        process nginx
root        2720  0.0  0.1   4420  2516 ?        S    10:36   0:00 nginx: master                                                                                        process nginx
nobody      2721  0.0  0.2  12624  5160 ?        S    10:36   0:00 nginx: worker                                                                                        process
root        2737  0.0  0.1 221664  2280 pts/0    S+   10:38   0:00 grep --color=                                                                                       auto nginx[root@webserver sbin]# curl -I 192.168.75.10
HTTP/1.1 200 OK
Server: nginx/1.26.1	#版本更新成功
Date: Thu, 24 Jul 2025 02:39:10 GMT
Content-Type: text/html
Content-Length: 14
Last-Modified: Thu, 24 Jul 2025 02:12:36 GMT
Connection: keep-alive
ETag: "68819694-e"
Accept-Ranges: bytes

?

?

nginx回滾

[root@webserver sbin]# curl -I 192.168.75.10
HTTP/1.1 200 OK
Server: nginx/1.26.1
Date: Thu, 24 Jul 2025 03:05:58 GMT
Content-Type: text/html
Content-Length: 14
Last-Modified: Thu, 24 Jul 2025 02:12:36 GMT
Connection: keep-alive
ETag: "68819694-e"
Accept-Ranges: bytes[root@webserver sbin]# ll
total 9400
-rwxr-xr-x 1 root root 3940656 Jul 24 10:35 nginx
-rwxr-xr-x 1 root root 5678264 Jul 23 15:40 nginx.old[root@webserver sbin]# mv nginx nginx.new
[root@webserver sbin]#
[root@webserver sbin]# mv nginx.old nginx
[root@webserver sbin]# ll
total 9400
-rwxr-xr-x 1 root root 5678264 Jul 23 15:40 nginx
-rwxr-xr-x 1 root root 3940656 Jul 24 10:35 nginx.new[root@webserver sbin]# ps aux | grep nginx
root        2795  0.0  0.1   9864  2496 ?        Ss   11:01   0:00 nginx: master process nginx
root        2822  0.0  0.1   4420  2516 ?        S    11:04   0:00 nginx: master process nginx
nobody      2823  0.0  0.2  12624  5180 ?        S    11:04   0:00 nginx: worker process
root        2849  0.0  0.1 221664  2280 pts/0    S+   11:06   0:00 grep --color=auto nginx[root@webserver sbin]# kill -HUP 2795	---拉起舊版本master進程[root@webserver sbin]# ps aux | grep nginx
root        2795  0.0  0.1   9864  2496 ?        Ss   11:01   0:00 nginx: master process nginx
root        2822  0.0  0.1   4420  2516 ?        S    11:04   0:00 nginx: master process nginx
nobody      2823  0.0  0.2  12624  5180 ?        S    11:04   0:00 nginx: worker process
nginx       2850  0.0  0.2  13760  4756 ?        S    11:07   0:00 nginx: worker process
root        2852  0.0  0.1 221664  2296 pts/0    S+   11:07   0:00 grep --color=auto nginx[root@webserver sbin]# kill -WINCH 2822	---回收新版本master進程[root@webserver sbin]# ps aux | grep nginx
root        2795  0.0  0.1   9864  2496 ?        Ss   11:01   0:00 nginx: master process nginx
root        2822  0.0  0.1   4420  2516 ?        S    11:04   0:00 nginx: master process nginx
nginx       2850  0.0  0.2  13760  4756 ?        S    11:07   0:00 nginx: worker process
root        2854  0.0  0.1 221664  2300 pts/0    S+   11:08   0:00 grep --color=auto nginx[root@webserver sbin]# curl -I 192.168.75.10
HTTP/1.1 200 OK
Server: nginx/1.24.0
Date: Thu, 24 Jul 2025 03:08:21 GMT
Content-Type: text/html
Content-Length: 14
Last-Modified: Thu, 24 Jul 2025 02:12:36 GMT
Connection: keep-alive
ETag: "68819694-e"
Accept-Ranges: bytes[root@webserver sbin]# kill -9 2822 ---[root@webserver sbin]# ps aux | grep nginx
root        2795  0.0  0.1   9864  2496 ?        Ss   11:01   0:00 nginx: master process nginx
nginx       2850  0.0  0.2  13760  4756 ?        S    11:07   0:00 nginx: worker process
root        2858  0.0  0.1 221664  2300 pts/0    S+   11:08   0:00 grep --color=auto nginx[root@webserver sbin]# curl -I 192.168.75.10
HTTP/1.1 200 OK
Server: nginx/1.24.0
Date: Thu, 24 Jul 2025 03:09:00 GMT
Content-Type: text/html
Content-Length: 14
Last-Modified: Thu, 24 Jul 2025 02:12:36 GMT
Connection: keep-alive
ETag: "68819694-e"
Accept-Ranges: bytes

?

?

?

源碼編譯nginx啟用system命令

#在瀏覽器中訪問
https://mailman.nginx.org/pipermail/nginx/2017-April/053368.html#復制配置文件并更改
[root@wb-nginx nginx-1.26.1]# vim /etc/systemd/system/nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target[Service]
Type=forking
PIDFile=/run/nginx.pid	---改為當前nginx.pid的目錄
ExecStartPre=/usr/sbin/nginx -t		---改為當前nginx所在目錄
ExecStart=/usr/sbin/nginx		---改為當前nginx所在目錄
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true[Install]
WantedBy=multi-user.target#更改為
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx  #此目錄為軟鏈接,實際指向/usr/local/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true[Install]
WantedBy=multi-user.target#編輯完成后保存退出
#清空當前nginx的所有進程,避免影響systemctl重啟nginx服務
[root@webserver system]# pkill -f nginx#查看是否清空
[root@webserver system]# netstat -antulpe | grep 80#重載systemctl
[root@webserver system]# systemctl daemon-reload#啟動nginx
[root@webserver system]# systemctl start nginx#查看狀態
[root@webserver system]# systemctl status nginx.service
● nginx.service - The NGINX HTTP and reverse proxy serverLoaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: di>Active: active (running) since Thu 2025-07-24 12:47:07 CST; 13s agoProcess: 4073 ExecStartPre=/usr/local/nginx/sbin/nginx -t (code=exited, sta>Process: 4074 ExecStart=/usr/local/sbin/nginx (code=exited, status=0/SUCCES>Main PID: 4075 (nginx)Tasks: 2 (limit: 10702)Memory: 1.6MCPU: 13msCGroup: /system.slice/nginx.service├─4075 "nginx: master process /usr/local/sbin/nginx"└─4076 "nginx: worker process"

?

?

nginx全局配置:高并發

?

#進入/usr/local/nginx/conf
vim nginx.confuser  nginx;
worker_cpu_affinity 0001 0010;	#cup綁定進程
worker_processes  2;	#設置開機自啟進程為2,通常與內核個數匹配
worker_rlimit_nofile 100000;	#每個工作進程最大文件描述符限制
error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;pid        logs/nginx.pid;events {worker_connections  100000;		#設置每個工作進程同時處理的最大連接數use epoll;	#設置i/o模型為異步非阻塞
}[root@webserver conf]# cd /etc/security/
[root@webserver security]# vim limits.conf
#@student        -       maxlogins       4
*                -       nofile          100000
*                -       nproc           100000#*                -       nofile          100000
含義:對所有用戶(* 通配符),將單個進程的最大打開文件數(nofile 即 "number of open files")限制為 100000。
作用:防止因文件描述符耗盡導致服務崩潰(如高并發 Web 服務、數據庫等)。# *                -       nproc           100000
含義:對所有用戶,將最大進程數(nproc 即 "max user processes")限制為 100000。
作用:防止用戶創建過多進程拖垮系統(如 fork 炸彈攻擊)。

?

創建一個簡單的pc站點

#添加策略指向子配置文件
include "/usr/local/nginx/conf.d/*.conf";

#創建目錄存放子配置目錄
mkdir -p /usr/local/nginx/conf.d#編寫子配置目錄
[root@webserver conf.d]# vim /usr/local/nginx/conf.d/vhosts.conf
server{listen  80;		#端口server_name www.test.org;	#訪問域名root    /web/html;	#默認發布目錄index   index.html;	#默認發布文件
}#重啟nginx服務
systemctl restart nginx#編寫本地解析
[root@webserver conf.d]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.75.150  rh9
192.168.75.10   webserver
192.168.75.10   www.test.org  #寫入域名

測試

[root@webserver conf.d]# curl 192.168.75.10  #訪問IP
192.168.75.10	
[root@webserver conf.d]# curl www.test.org	#訪問域名=
web_html

nginx賬戶認證功能

#創建nginx所需要的認證文件  當認證文件不存在時需要-c建立
[root@webserver conf.d]# htpasswd -cm /usr/local/nginx/.htpasswd admin
New password:	#輸入密碼
Re-type new password:	#再次輸入密碼
Adding password for user admin#創建新用戶  	當認證文件存在時使用-c會覆蓋原文件內容
[root@webserver conf.d]# htpasswd -m /usr/local/nginx/.htpasswd yna
New password:
Re-type new password:
Adding password for user yna[root@webserver conf.d]# cat /usr/local/nginx/.htpasswd
admin:$apr1$QZW0/k7N$RPsbM9A80xtD5t9WASs4h1
yna:$apr1$mMCbF9jP$T0g/Pi52ZKK0j8Egg8KBS1#創建文件放置認證成功的內容
[root@webserver ~]# mkdir -p /web/nginx/test.org/yna/login
[root@webserver ~]#
[root@webserver ~]# echo login > /web/nginx/test.org/yna/login/index.html#編輯配置文件
server{listen  80;server_name www.test.org;root    /web/html;index   index.html;error_page 500 502 503 404 403 /errorpage/error.html;error_log /usr/local/nginx/logs/test.org.err;access_log /usr/local/nginx/logs/test.org.access;location = /test {return 200 "= \n";}location ^~ /test {return 200 "^~ \n";}location ~* /test {return 200 "~* \n";}location /login/{root /web/nginx/test.org/yna;  #訪問目錄index index.html;auth_basic "PLIEASE input username and password";	# 是 Nginx 提供的指令,用來“打開” Basic 認證。auth_basic_user_file /usr/local/nginx/.htpasswd;#指定保存“賬號/密碼”的文件路徑}location /errorpage {root /web/;}
}#重啟并測試
[root@webserver 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@webserver conf.d]# nginx -s reload[root@webserver conf.d]# curl www.test.org/login/ -u yna:123456
login

?

location參數

#alias與root的區別root:路徑末尾是否加 / 都可以。
alias:末尾必須加 /,否則可能導致路徑錯誤location /static/ {root /var/www/html;
}
#請求/static/images/logo.png 實際路徑/var/www/html/static/images/logo.pnglocation /static/ {alias /var/www/assets/;
}
#請求 /static/images/logo.png 實際路徑/var/www/assets/images/logo.png

自定義錯誤界面

#創建錯誤存放錯誤界面內容的文件目錄
[root@webserver conf.d]# mkdir /web/errorpage
[root@webserver conf.d]# echo "bad" > /web/errorpage/error.html#編輯配置文件
server{listen  80;server_name www.test.org;root    /web/html;index   index.html;error_page 500 502 503 404 403 /errorpage/error.html;	#寫入錯誤碼以及發生這些錯誤時應指向的文件#重啟并測試
[root@webserver 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@webserver conf.d]# nginx -s reload
[root@webserver conf.d]# curl www.test.org
web_html
[root@webserver conf.d]# curl www.test.org/ab
bad

自定義錯誤日志

#編寫配置文件
server{listen  80;server_name www.test.org;root    /web/html;index   index.html;error_page 500 502 503 404 403 /errorpage/error.html;error_log /usr/local/nginx/logs/test.org.err;access_log /usr/local/nginx/logs/test.org.access;#測試

檢測文件是否存在

vim /usr/loacl/nginx/conf/conf.d/vhosts.conf
echo default > /web/errorpage/default.html	#寫入默認發布頁try_files $uri $uri.html $uri/index.html /errorpage/default.html;	#在子配置文件寫入,先檢查磁盤上是否恰好存在與請求 URI 同名的文件。如果上一步沒找到,再嘗試給 URI 加 .html 后綴。如果前兩步都沒命中,再把它當成目錄,看目錄內有沒有 index.html。前三步都失敗時,Nginx 會內部重寫到這個回退 URI(相當于重新發起一次子請求)。#測試
[root@webserver conf.d]# curl www.test.org/a
default

長鏈接配置

[root@webserver conf.d]# cd /usr/local/nginx/conf
[root@webserver conf]# vim nginx.confhttp {include       mime.types;default_type  application/octet-stream;# default_type  test/html;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  logs/access.log  main;sendfile        on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout  60 50;	#設置用戶訪問超時時間,超時自動斷開 60為實際超時時間,50為顯示給用戶的超時時間keepalive_requests 120;	#設置最大并發量Features: alt-svc AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
[root@webserver conf]# curl -v 192.168.75.10
*   Trying 192.168.75.10:80...
* Connected to 192.168.75.10 (192.168.75.10) port 80 (#0)
> GET / HTTP/1.1
> Host: 192.168.75.10
> User-Agent: curl/7.76.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.26.1
< Date: Sat, 26 Jul 2025 03:41:51 GMT
< Content-Type: text/html
< Content-Length: 14
< Last-Modified: Thu, 24 Jul 2025 02:12:36 GMT
< Connection: keep-alive
< Keep-Alive: timeout=50	#最大超時時間
< ETag: "68819694-e"
< Accept-Ranges: bytes
<
192.168.75.10
* Connection #0 to host 192.168.75.10 left intact[root@webserver ~]# dnf install telnet -y	#安裝測試工具[root@webserver ~]# telnet 192.168.75.10 80
Trying 192.168.75.10...
Connected to 192.168.75.10.
Escape character is '^]'.
GET / HTTP/1.1	#手動寫入
Host: 192.168.75.10	#手動寫入HTTP/1.1 200 OK
Server: nginx/1.26.1
Date: Sat, 26 Jul 2025 03:03:30 GMT
Content-Type: text/html
Content-Length: 14
Last-Modified: Thu, 24 Jul 2025 02:12:36 GMT
Connection: keep-alive
Keep-Alive: timeout=50	#超時時間
ETag: "68819694-e"
Accept-Ranges: bytes192.168.75.10	#表示成功請求一次

?超時顯示:

作為下載服務器的配置

vim /etc/local/nginx/conf/conf.d/vhosts.conflocation /download{root /web/;autoindex on;autoindex_localtime on;	#自動文件索引功能,默為offautoindex_exact_size off;#計算文件確切大小(單位bytes),off 顯示大概大小(單位K、M),默認onautoindex_format html;#顯示索引的頁面文件風格,默認htmlset $limit_rate 1024k;#限制響應客戶端傳輸速率(除GET和HEAD以外的所有方法),單位B/s,bytes/second,}[root@webserver conf.d]# curl www.test.org/download/
<html>
<head><title>Index of /download/</title></head>
<body>
<h1>Index of /download/</h1><hr><pre><a href="../">../</a>
<a href="yna">yna</a>                                                26-Jul-2025 11:05    200M
</pre><hr></body>
</html>[[root@webserver conf]# wget www.test.org/download/yna #嘗試下載
--2025-07-26 11:39:47--  http://www.test.org/download/yna
Resolving www.test.org (www.test.org)... 192.168.75.10
Connecting to www.test.org (www.test.org)|192.168.75.10|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 209715200 (200M) [application/octet-stream]
Saving to: ‘yna’yna                                         3%[=>                        ]   6.00M  1.01MB/s    eta 3m 13s ^C	#發現限速1mb左右

????????

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/917519.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/917519.shtml
英文地址,請注明出處:http://en.pswp.cn/news/917519.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【選型】HK32L088 與 STM32F0/L0 系列 MCU 參數對比與選型建議(ST 原廠 vs 國產芯片)(單片機選型主要考慮的參數與因素)

國產 vs ST 單片機在工業控制中的性能對比分析 HK32L088 與 STM32F0/L0 系列 MCU 參數對比與選型建議 工業控制領域 MCU 選型:國產航順 HK32 與 ST 原廠芯片深入比較 國產 MCU 是否可替代 ST?基于發電機控制應用的深入評估 從數據手冊看 MCU 制造工藝差異:HK32L088 vs S…

LLM Prompt與開源模型資源(1)提示詞工程介紹

學習材料&#xff1a;https://www.hiascend.com/developer/courses/detail/1935520434893606913學習時長&#xff1a; 預計 30 分鐘學習目的&#xff1a; 了解提示工程的定義與作用 熟悉提示工程的關鍵技術相關概念 掌握基于昇騰適配的大模型提示工程的入門及進階指南 提示…

kafka與其他消息隊列(如 RabbitMQ, ActiveMQ)相比,有什么優缺點?

Kafka、RabbitMQ 和 ActiveMQ 是三種最主流的消息中間件&#xff0c;它們的設計和適用場景有所不同。 我們可以通過一個簡單的表格來快速了解它們的核心區別&#xff1a; 核心對比一覽特性 / 維度KafkaRabbitMQActiveMQ核心模型分布式、持久化的日志系統 (Dumb Broker / Smart …

Kubernetes架構和部署

k8s組件 master節點:管理節點 管理平面組件 api server : api gateway controller manager scheduler etcd 數據庫 worker節點:被管理節點,運行容器 kubelet:k8s agent container runtime:docker,containerd,cri-o kube-proxy:service 網絡 ????????…

建造者模式及優化

建造者模式是一種創建型設計模式&#xff0c;它將復雜對象的構建過程與表示分離&#xff0c;使得同樣的構建過程可以創建不同的表示。核心思想是指揮者定流程&#xff0c;建造者填細節&#xff0c;通過多個步驟逐步構建對象&#xff0c;并允許靈活組合這些步驟以生成不同配置的…

【09】C++實戰篇——C++ 生成靜態庫.lib 及 C++調用lib,及實際項目中的使用技巧

文章目錄1 C 靜態庫.lib 生成1.1 靜態庫lib的生成方法和使用方法1.2 創建靜態庫項目1.3 編寫.h 和 .cpp文件1.4 設置 及 生成 DLL2 調用 C 靜態庫lib2.1 新建LIBtest及測試代碼2.2 靜態庫配置 及代碼調用測試3 實際項目中的使用技巧、及通用設置3.1 設置lib輸出路徑3.2 設置頭文…

飛算JavaAI:從寫不出代碼到絲滑開發,飛算JavaAI把小白從編程深淵撈進了正軌---它都讓我懷疑自己是不是多余的!

開篇介紹 對于很多初學者來說&#xff0c;編程是一項既有趣又充滿挑戰的任務。面對復雜的代碼和繁瑣的開發流程&#xff0c;常常會感到無從下手。不過&#xff0c;現在有了飛算JavaAI&#xff0c;這一切都將變得簡單起來。 它有啥實用功能呢&#xff1f; 比如&#xff1a; …

關于tresos Studio(EB)的MCAL配置之GtmCfg

Generic Time Module通用時鐘模塊GeneralGtmCfg_DevErrorDetect開發者錯誤檢測開關GtmCfg_DemErrorReporting診斷錯誤報告開關GtmCfg_VersionInfoApi獲取版本信息的接口開關GtmCfg_ConfigSetClockManagementUnitGlobal_Clock_Control_Numerator全局時鐘分頻器的分子Global_Cloc…

深入探索Weaviate:構建高效AI應用的數據庫解決方案

在當今數據驅動的世界中&#xff0c;高效地存儲、檢索和處理大規模數據成為了AI應用開發的關鍵挑戰。Weaviate作為一個開源的向量搜索引擎&#xff0c;憑借其強大的功能和靈活的架構&#xff0c;正逐漸成為開發者構建智能AI應用的首選工具。本文將深入探討Weaviate的核心概念、…

【開源】一款開源、跨平臺的.NET WPF 通用權限開發框架 (ABP) ,功能全面、界面美觀

文章目錄一、開源地址二、框架介紹三、技術路線四、適用場景五、功能模塊六、框架演示截圖一、開源地址 Gihub地址&#xff1a; https://github.com/HenJigg/wpf-abp B站學習視頻&#xff1a;https://www.bilibili.com/video/BV1nY411a7T8?spm_id_from333.788.player.switch&…

信創緩存中間件-TongRDS(Redis平替)安裝

TongRDS 是由東方通開發的國產 分布式內存數據緩存中間件&#xff0c;功能類似于 Redis&#xff0c;但它是完全自主研發的國產產品&#xff0c;是國內信創的一大重要組件。它兼容 Redis 的接口&#xff0c;能做到應用代碼無需改動即可替換使用。TongRDS是沒有直接的下載地址的。…

Git鏈接備用手冊

三板斧及其他&#xff1a;git init&#xff1a;初始化git倉庫git add . :將所在文件夾中的所有文件加入到暫存區git commit -m 自定義記錄信息 &#xff1a;將暫存區中的數據放到Git的倉庫&#xff08;本地&#xff09;中&#xff0c;并進行記錄&#xff08;自定義&#xff0…

零信任網絡概念及在網絡安全中的應用

零信任網絡概念及在網絡安全中的應用 零信任網絡&#xff08;Zero Trust Network&#xff09;是一種顛覆傳統邊界安全的架構理念&#xff0c;其核心是**“永不信任&#xff0c;始終驗證”**&#xff08;Never Trust, Always Verify&#xff09;。它假設網絡內外均存在威脅&…

GaussDB case when的用法

1 case函數的類型case具有兩種格式&#xff0c;簡單case函數和case搜索函數。這兩種方式&#xff0c;大部分情況下可以實現相同的功能。1.1 簡單case函數語法case column when <condition> then value when <condition> then value ...... else value end;示例case…

Git用法記錄

代碼中沖突標記的含義&#xff1a;<<<<<<< HEAD 標記當前分支&#xff08;或本地&#xff09;的舊代碼作為分隔線 >>>>>>> [commit哈希] 標記從其他分支合并過來的新代碼&#xff08;這里的 c472b4b... 是提交哈希&#xff09; 暫存…

解決Android Studio中創建的模擬器第二次無法啟動的問題

Android Studio中創建的模擬器&#xff0c;首次啟動時一切正常。但是關閉模擬器&#xff0c;下一次啟動時一直顯示&#xff1a;Connecting to the Emulator&#xff0c;無法啟動。無法啟動的原因通常是默認開啟了模擬器的快速啟動功能&#xff0c;首次啟動時是“冷啟動”&#…

Linux設備驅動架構相關文章

學習一個領域&#xff0c;最好是從多個角度去學習&#xff0c;總有一個角度適合你。學習Linux驅動&#xff0c;從架構的角度把握&#xff0c;比直接看代碼更容易接受。以架構為主&#xff0c;結合細節學習&#xff0c;我稱之為自上而下的學習方法&#xff0c;就一個字&#xff…

YOLOv13 漢化優化部署版本:超圖增強自適應視覺感知的目標檢測系統

目錄 &#x1f4d6; 項目概述&#x1f680; YOLOv13 核心特性&#x1f4ca; 性能對比&#x1f5bc;? 可視化效果&#x1f527; 項目優化改進?? 快速部署指南?? 運行使用&#x1f4dd; 使用示例&#x1f527; 故障排除&#x1f31f; 項目特色&#x1f517; 相關鏈接&#…

uni-app webview的message監聽不生效(uni.postmessage is not a function)

uni-app開發app web-view組件message事件不觸發背景子頁面是h5&#xff08;非uni-app版&#xff09;子頁面是h5&#xff08;uni-app版&#xff09;背景 大致背景是 在uni-app開發的客戶端app中使用web-view嵌入h5頁面&#xff0c;在h5中通過postmessage API觸發父組件web-view…

【異常案例分析】使用空指針調用函數(非虛函數)時,沒有崩潰在函數調用處,而是崩在被調用函數內部

目錄 1、問題說明 2、代碼段地址與數據段地址 3、使用空指針調用BindWindow函數&#xff08;非虛函數&#xff09;&#xff0c;沒有崩在BindWindow函數的調用處&#xff0c;而是崩在函數內部 3.1、虛函數調用的二次尋址 3.2、崩潰在被調用函數內部 4、總結 C軟件異常排查…