编译安装Nginx+GeoIP2自动更新+防盗链+防爬虫+限制访问速度+限制连接数
此文章是Nginx的GeoIP2模块和MaxMind国家IP库相互结合,达到客户端IP访问的一个数据记录以及分析,同时还针对一些业务需求做出对Nginx中间件的控制,如:防盗链、防爬虫、限制访问速度、限制连接数等
该篇文章是从一个热爱搞技术的博主StephenJose_Dai文章中学习并实验后编写的,在此非常感谢这位博主!
环境
| 名称+版本 | 官方下载链接 | 本地下载链接 |
|---|---|---|
| CentOS7.9 | http://isoredirect.centos.org/centos/7/isos/x86_64/ | 无 |
| Nginx1.22 | https://nginx.org/download/nginx-1.22.1.tar.gz | https://resource.if010.com/geoip/nginx-1.22.1.tar.gz |
| GeoIP2模块v3.3 | https://github.com/leev/ngx_http_geoip2_module/releases | https://resource.if010.com/geoip/ngx_http_geoip2_module-3.3.tar.gz |
| MaxMind国家IP库 | https://www.maxmind.com/en/home | 无 |
| libmaxminddb 1.7.1 | https://github.com/maxmind/libmaxminddb/releases | https://resource.if010.com/geoip/libmaxminddb-1.7.1.tar.gz |
| geoipupdate 6.0.0 | https://github.com/maxmind/geoipupdate/releases/download/v6.0.0/geoipupdate_6.0.0_linux_386.tar.gz | https://resource.if010.com/geoip/geoipupdate_6.0.0_linux_386.tar.gz |
注:libmaxminddb工具是用于解析MaxMind国家IP库文件的。
开搞
约定:所有安装包和准备材料都放在了
/data目录下。
编译安装libmaxminddb
tar -zxvf libmaxminddb-1.7.1.tar.gz
cd libmaxminddb-1.7.1
./configure
make && make check && make install
ldconfig
如果安装后,您收到一个libmaxminddb.so.0丢失的错误,您可能需要将前缀中的 lib 目录添加到您的库路径中。在使用默认前缀 ( /usr/local) 的大多数 Linux 发行版上,您可以通过运行以下命令来执行此操作:
sudo sh -c "echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf"
ldconfig
解压GeoIP2
tar -zxvf ngx_http_geoip2_module-3.3.tar.gz
mv ngx_http_geoip2_module-3.3 /usr/local/
注意:因为这里使用的是Nginx1.22的版本,所以GeoIP2只能用3.3版本的,不然会报错!
编译安装Nginx前的一些依赖准备
我们这里编译安装Nginx需要用的有openssl、pcre、zlib、gcc,在此之前我们先解压编译包并放到指定目录,然后使用rpm安装gcc
这里的用到的依赖分享到了CSDN上,有需要的小伙伴可以自取
tar zxf pcre-8.42.tar.gz
mv pcre-8.42 /usr/local/
tar zxf openssl-1.1.0h.tar.gz
mv openssl-1.1.0h /usr/local/
tar zxf zlib-1.2.11.tar.gz
mv zlib-1.2.11 /usr/local/# rpm安装gcc
rpm -ivh libstdc++-devel-4.8.5-44.el7.x86_64.rpm
rpm -ivh gcc-c++-4.8.5-44.el7.x86_64.rpm
编译安装Nginx
tar -zxvf nginx-1.22.1.tar.gz
cd /data/nginx-1.22.1#配置编译
./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-stream --with-openssl=/usr/local/openssl-1.1.0h/ --with-pcre=/usr/local/pcre-8.42/ --with-zlib=/usr/local/zlib-1.2.11/ --add-module=/usr/local/ngx_http_geoip2_module-3.3# 编译并安装
make && make install
注册MaxMind帐号并下载国家IP数据库



将下载的数据库解压并放到指定位置
这个位置并不一定说是要在哪里,只要到时候你Nginx调用的时候路径是对的就行
mkdir -p /usr/local/nginx/IPData/
tar -zxvf GeoLite2-Country_20231020.tar.gz
cd GeoLite2-Country_20231020
mv GeoLite2-Country.mmdb /usr/local/nginx/IPData/
配置Nginx实现禁止境外IP访问、防盗链、防爬虫、限制访问速度、限制连接数
创建虚拟主机配置文件目录和缓存目录
mkdir -p /usr/local/nginx/conf/v_host/
mkdir -p /usr/local/nginx/cache
编辑Nginx主配置文件vim /usr/local/nginx/conf/nginx.conf
user nobody;# 配置Nginx线程数,这里设置为自动
worker_processes auto;error_log logs/error.log;
pid logs/nginx.pid;events {# 定义每个线程可以处理1024个连接请求worker_connections 1024;
}http {log_format main '$remote_addr - [location: $geoip2_data_country_code $geoip2_country_name $geoip2_data_city_name $geoip2_data_province_name $geoip2_data_province_isocode $geoip2_continent_code] - $remote_user [$time_local] requesthost:"$http_host"; "$request" requesttime:"$request_time"; ''$status $body_bytes_sent "$http_referer" - $request_body ' '"$http_user_agent" "$http_x_forwarded_for"';access_log logs/access.log main;sendfile on;tcp_nopush on;tcp_nodelay on;# 关闭Nginx版本号显示server_tokens off;proxy_buffering off;keepalive_timeout 300;keepalive_requests 200;client_max_body_size 20M;types_hash_max_size 2048;fastcgi_connect_timeout 300s;fastcgi_send_timeout 300s;fastcgi_read_timeout 300s;fastcgi_buffer_size 512k;fastcgi_buffers 10 512k;fastcgi_busy_buffers_size 1024k;fastcgi_temp_file_write_size 1024k;open_file_cache max=65535 inactive=60s;open_file_cache_valid 80s;server_names_hash_bucket_size 2048;client_header_buffer_size 128k;client_body_buffer_size 512k;large_client_header_buffers 4 128k;proxy_hide_header X-Powered-By;proxy_hide_header Server;proxy_connect_timeout 300;proxy_send_timeout 300;proxy_read_timeout 300;proxy_buffer_size 4k;proxy_buffers 4 64k;proxy_busy_buffers_size 128k;proxy_temp_file_write_size 128k;proxy_temp_path cache/mytemp_cache;proxy_cache_path cache/mytest_cache levels=1:2 keys_zone=mytest:20m inactive=24h max_size=1000m;proxy_intercept_errors on;gzip_min_length 1k;gzip_buffers 4 16k;gzip_comp_level 4;gzip_types text/plain application/javascript image/png text/css text/xml text/vnd.wap.wml text/x-component application/x-javascript image/gif image/jpeg application/atom+xml application/rss+xml application/octet-stream application/x-rar-compressed application/json;gzip_http_version 1.1;gzip_vary on;gzip_disable "msie6";gzip on;include mime.types;default_type application/octet-stream;# 配置国家IP库geoip2 /usr/local/nginx/IPData/GeoLite2-Country.mmdb{auto_reload 5m;$geoip2_metadate_country_build metadata build_epoch;$geoip2_data_country_code country iso_code;$geoip2_country_name country names en;}# 配置城市IP库geoip2 /usr/local/nginx/IPData/GeoLite2-City.mmdb {auto_reload 5m;$geoip2_data_city_name city names en;$geoip2_data_province_name subdivisions 0 names en;$geoip2_data_province_isocode subdivisions 0 iso_code;$geoip2_continent_code continent code;}#配置规则,默认不允许所有IP访问,只允许中国IP访问map $geoip2_data_country_code $allowed_country {default no;CN yes;}#设置白名单,在下列白名单中不限速geo $is_whitelist {default 0;172.17.0.0/16 1;}map $is_whitelist $limit_key {1 "";0 $binary_remote_addr; } # 设置连接数limit_conn_zone $binary_remote_addr zone=perip:10m;# 设置限制连接数,每秒150个连接数limit_req_zone $binary_remote_addr zone=myRateLimit:10m rate=150r/s;# 设置限制连接数,每秒2000个连接数 limit_req_zone $binary_remote_addr zone=mywebRateLimit:10m rate=2000r/s;# 设置限制连接数,每秒200个连接数limit_req_zone $binary_remote_addr zone=my26051RateLimit:10m rate=200r/s;# 引用v_host中的指定conf配置文件include /usr/local/nginx/conf/v_host/*.conf;
}
创建编辑虚拟主机配置文件vim /usr/local/nginx/conf/v_host/test.if010.com.conf
# HTTP配置
server {listen 80;charset utf-8;server_name test.if010.com;client_max_body_size 300m;access_log /usr/local/nginx/logs/test.if010.com_access.log main;error_log /usr/local/nginx/logs/test.if010.com_error.log debug;# 当访问http时,强制跳转到httpserror_page 497 https://test.if010.com$uri?$args;# 添加客户端的IP头add_header client-country $geoip2_data_country_code;# 启用压缩,压缩等级为9级,压缩text/css text/plan text/xml application/javascript# application/x-javascript application/html application/xml image/png image/jpg# image/jpeg image/gif image/webp image/svg+xml 这些格式的文件gzip on;gzip_comp_level 9;gzip_types text/css text/plan text/xml application/javascript application/x-javascript application/html application/xml image/png image/jpg image/jpeg image/gif image/webp image/svg+xml;# 做判断,如果国家不是中国,就返回451状态码给客户端;if ($geoip2_data_country_code != CN ) {return 451;}# 做判断,如果匹配到默认不允许的规则,就返回452状态码给客户端; if ($geoip2_data_country_code = no ) {return 452;}location /{root /usr/local/nginx/html;index index.html;try_files $uri $uri/ /index.html?s=$uri&$args;# 限制连接数为nginx.conf配置的zone=myRateLimit的值(每秒150个请求数),允许突然爆发的连接数10个并且是马上执行没有延迟limit_req zone=myRateLimit burst=10 nodelay;# 限制每个IP每秒连接数为nginx.conf配置的zone=perip的值(单个IP允许150个请求数)limit_conn perip 150;# 如果超过设定的每秒150个连接数这个阈值,则返回448状态码给客户端limit_req_status 448;# 如果超过设定的每个IP每秒150个连接数这个阈值,则返回449状态码给客户端limit_conn_status 449;# 限制客户端速度只能到150klimit_rate 150k;# 防盗链,如果请求的头不是test.if010.com就是无效的,则返回449状态码给客户端 valid_referers none blocked test.if010.comm;if ($invalid_referer) {return 449;}# 做判断,如果国家不是中国,就返回451状态码给客户端; if ($geoip2_data_country_code != CN ) {return 451;}# 做判断,如果匹配到默认不允许的规则,就返回452状态码给客户端 if ($geoip2_data_country_code = no ) {return 452;}# 防爬虫,如果UA是底下任意一个值,就判定为蜘蛛爬虫,则返回453给客户端if ($http_user_agent ~* "python|curl|java|wget|httpclient|okhttp|qihoobot|Scrubby|YodaoBot|yahoo-blogs/v3.9|Gigabot|yahoo-mmcrawler|Teoma|Robozilla|Bingbot|Slurp|Baiduspider|Googlebot|googlebot-mobile|googlebot-image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo!Slurp|Yahoo!Slurp China|YoudaoBot|Sosospider|MSNBot|ia_archiver|twiceler|psbot") {return 453;}}# 错误页配置,如果状态码是下列的值,就显示我配置的页面error_page 400 401 402 403 404 500 502 503 504 /error.html;location = /error.html {root /usr/local/html;# 限制连接数为nginx.conf配置的zone=myRateLimit的值(每秒150个请求数),允许突然爆发的连接数10个并且是马上执行没有延迟limit_req zone=myRateLimit burst=10 nodelay;# 限制每个IP每秒连接数为nginx.conf配置的zone=perip的值(单个IP允许150个请求数)limit_conn perip 150;# 如果超过设定的每秒150个连接数这个阈值,则返回448状态码给客户端limit_req_status 448;# 如果超过设定的每个IP每秒150个连接数这个阈值,则返回449状态码给客户端limit_conn_status 449;# 限制客户端速度只能到150klimit_rate 150k;# 防盗链,如果请求的头不是test.if010.com就是无效的,则返回449状态码给客户端 valid_referers none blocked test.if010.com;if ($invalid_referer) {return 449;}# 做判断,如果国家不是中国,就返回451状态码给客户端; if ($geoip2_data_country_code != CN ) {return 451;}# 做判断,如果匹配到默认不允许的规则,就返回452状态码给客户端 if ($geoip2_data_country_code = no ) {return 452;}# 防爬虫,如果UA是底下任意一个值,就判定为蜘蛛爬虫,则返回453给客户端 if ($http_user_agent ~* "python|curl|java|wget|httpclient|okhttp|qihoobot|Scrubby|YodaoBot|yahoo-blogs/v3.9|Gigabot|yahoo-mmcrawler|Teoma|Robozilla|Bingbot|Slurp|Baiduspider|Googlebot|googlebot-mobile|googlebot-image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo!Slurp|Yahoo!Slurp China|YoudaoBot|Sosospider|MSNBot|ia_archiver|twiceler|psbot") {return 453;}}
}# HTTPS配置server {listen 443 ssl;charset utf-8;server_name test.if010.com;client_max_body_size 300m;ssl_certificate /usr/local/nginx/cert/test.if010.com.pem;ssl_certificate_key /usr/local/nginx/cert/test.if010.com.key;ssl_session_timeout 5m;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_prefer_server_ciphers on;access_log /usr/local/nginx/logs/test.if010.com_access.log main;error_log /usr/local/nginx/logs/test.if010.com_error.log debug;# 添加客户端的IP头add_header client-country $geoip2_data_country_code;# 启用压缩,压缩等级为9级,压缩text/css text/plan text/xml application/javascript# application/x-javascript application/html application/xml image/png image/jpg# image/jpeg image/gif image/webp image/svg+xml 这些格式的文件gzip on;gzip_comp_level 9;gzip_types text/css text/plan text/xml application/javascript application/x-javascript application/html application/xml image/png image/jpg image/jpeg image/gif image/webp image/svg+xml;# 做判断,如果国家不是中国,就返回451状态码给客户端;if ($geoip2_data_country_code != CN ) {return 451;}# 做判断,如果匹配到默认不允许的规则,就返回452状态码给客户端; if ($geoip2_data_country_code = no ) {return 452;}location /{root /usr/local/nginx/html;index index.html;try_files $uri $uri/ /index.html?s=$uri&$args;# 限制连接数为nginx.conf配置的zone=myRateLimit的值(每秒150个请求数),允许突然爆发的连接数10个并且是马上执行没有延迟limit_req zone=myRateLimit burst=10 nodelay;# 限制每个IP每秒连接数为nginx.conf配置的zone=perip的值(单个IP允许150个请求数)limit_conn perip 150;# 如果超过设定的每秒150个连接数这个阈值,则返回448状态码给客户端limit_req_status 448;# 如果超过设定的每个IP每秒150个连接数这个阈值,则返回449状态码给客户端limit_conn_status 449;# 限制客户端速度只能到150klimit_rate 150k;# 防盗链,如果请求的头不是test.if010.com就是无效的,则返回449状态码给客户端valid_referers none blocked test.if010.com;if ($invalid_referer) {return 449;}# 做判断,如果国家不是中国,就返回451状态码给客户端; if ($geoip2_data_country_code != CN ) {return 451;}# 做判断,如果匹配到默认不允许的规则,就返回451状态码给客户端 if ($geoip2_data_country_code = no ) {return 452;}# 防爬虫,如果UA是底下任意一个值,就判定为蜘蛛爬虫,则返回453给客户端if ($http_user_agent ~* "python|curl|java|wget|httpclient|okhttp|qihoobot|Scrubby|YodaoBot|yahoo-blogs/v3.9|Gigabot|yahoo-mmcrawler|Teoma|Robozilla|Bingbot|Slurp|Baiduspider|Googlebot|googlebot-mobile|googlebot-image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo!Slurp|Yahoo!Slurp China|YoudaoBot|Sosospider|MSNBot|ia_archiver|twiceler|psbot") {return 453;}}# 错误页配置,如果状态码是下列的值,就显示我配置的页面error_page 400 401 402 403 404 500 502 503 504 /error.html;location = /error.html {root /usr/local/html;# 限制连接数为nginx.conf配置的zone=myRateLimit的值(每秒150个请求数),允许突然爆发的连接数10个并且是马上执行没有延迟limit_req zone=myRateLimit burst=10 nodelay;# 限制每个IP每秒连接数为nginx.conf配置的zone=perip的值(单个IP允许150个请求数)limit_conn perip 150;# 如果超过设定的每秒150个连接数这个阈值,则返回448状态码给客户端limit_req_status 448;# 如果超过设定的每个IP每秒150个连接数这个阈值,则返回449状态码给客户端limit_conn_status 449;# 限制客户端速度只能到150klimit_rate 150k;# 防盗链,如果请求的头不是test.if010.com就是无效的,则返回449状态码给客户端 valid_referers none blocked test.if010.com;if ($invalid_referer) {return 449;}# 做判断,如果国家不是中国,就返回451状态码给客户端; if ($geoip2_data_country_code != CN ) {return 451;}# 做判断,如果匹配到默认不允许的规则,就返回452状态码给客户端 if ($geoip2_data_country_code = no ) {return 452;}# 防爬虫,如果UA是底下任意一个值,就判定为蜘蛛爬虫,则返回453给客户端 if ($http_user_agent ~* "python|curl|java|wget|httpclient|okhttp|qihoobot|Scrubby|YodaoBot|yahoo-blogs/v3.9|Gigabot|yahoo-mmcrawler|Teoma|Robozilla|Bingbot|Slurp|Baiduspider|Googlebot|googlebot-mobile|googlebot-image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo!Slurp|Yahoo!Slurp China|YoudaoBot|Sosospider|MSNBot|ia_archiver|twiceler|psbot") {return 453;}}
}
验证测试

实现自动更新国家IP库
获取geoipupdate官方工具
tar -zxvf geoipupdate_6.0.0_linux_386.tar.gz
cd geoipupdate_6.0.0_linux_386/
mv geoipupdate /usr/local/nginx/IPData/
mv GeoIP.conf /usr/local/nginx/IPData/
创建LicenseKey


配置GeoIP.conf
vim /usr/local/nginx/IPData/GeoIP.conf# Please see https://dev.maxmind.com/geoip/updating-databases?lang=en for
# instructions on setting up geoipupdate, including information on how to
# download a pre-filled GeoIP.conf file.# Replace YOUR_ACCOUNT_ID_HERE and YOUR_LICENSE_KEY_HERE with an active account
# ID and license key combination associated with your MaxMind account. These
# are available from https://www.maxmind.com/en/my_license_key.
AccountID xxxx #这里填写刚才记下的ID
LicenseKey xxxx_xxxxxxxxxxxxxxx_xxx #这里填写刚才记下的key# Enter the edition IDs of the databases you would like to update.
# Multiple edition IDs are separated by spaces.
EditionIDs GeoLite2-Country GeoLite2-City# The remaining settings are OPTIONAL.# The directory to store the database files. Defaults to /usr/local/share/GeoIP
DatabaseDirectory /usr/local/nginx/IPData/ #这里本来是注释掉的,取消注释修改成你数据库存放的位置# The server to use. Defaults to "updates.maxmind.com".
# Host updates.maxmind.com# The proxy host name or IP address. You may optionally specify a
# port number, e.g., 127.0.0.1:8888. If no port number is specified, 1080
# will be used.
# Proxy 127.0.0.1:8888# The user name and password to use with your proxy server.
# ProxyUserPassword username:password# Whether to preserve modification times of files downloaded from the server.
# Defaults to "0".
# PreserveFileTimes 0# The lock file to use. This ensures only one geoipupdate process can run at a
# time.
# Note: Once created, this lockfile is not removed from the filesystem.
# Defaults to ".geoipupdate.lock" under the DatabaseDirectory.
LockFile /usr/local/nginx/IPData/.geoipupdate.lock #这里本来是注释掉的,取消注释修改成你数据库存放的位置# The amount of time to retry for when errors during HTTP transactions are
# encountered. It can be specified as a (possibly fractional) decimal number
# followed by a unit suffix. Valid time units are "ns", "us" (or "µs"), "ms",
# "s", "m", "h".
# Defaults to "5m" (5 minutes).
# RetryFor 5m# The number of parallel database downloads.
# Defaults to "1".
# Parallelism 1
启动geoipupdate
根据官方提供的参数来看,默认数据库会下到/usr/local/share下,所以我们要加个参数让它存放到/usr/local/nginx/IPData, -d跟–database-directory一样,指定数据库存放位置, -f跟–config-file一样,就是指定配置文件
./geoipupdate -d /usr/local/nginx/IPData -f /usr/local/nginx/IPData/GeoIP.conf
等一会它就更新完了,更新完后用ll命令看下时间,如果时间是当前时间,那就说明更新成功。
创建定时任务
创建一个shell脚本
mkdir -p /usr/local/script/logs/
cd /usr/local/nginx/IPData/
vim autoupdate.sh#!/bin/bash
########################################################################
# Function :自动更新IP数据库 #
# Platform :Centso 6.x and 7.x (Base) #
# Version :2.0 #
# C_Date :2023-10-20 #
# U_Date :2023-10-20 #
# Author :Kim #
# Contact :StephenJose_Dai #
# Tips :Please don't delete it #
# Used :确保/usr/local/nginx/IPData下有geoipupdate和GeoIP.conf文件 #
# 再把脚本放入 /usr/local/script/下,然后运行即可 #
# Log :用于自动更新国家IP数据库和城市IP数据库的程序 #
########################################################################
current_time=$(date "+%Y-%m-%d %H:%M:%S")
/usr/local/nginx/IPData/geoipupdate -d /usr/local/nginx/IPData/ -f /usr/local/nginx/IPData/GeoIP.conf
echo "[${current_time}] UpdateSuccessfully!"chmod +x autoupdate.shcrontab -e
00 02 * * * /usr/local/nginx/IPData/autoupdate.sh >> /usr/local/script/logs/geoipupdate.log 2>&1重启crond服务
systemctl restart crond
相关文章:
编译安装Nginx+GeoIP2自动更新+防盗链+防爬虫+限制访问速度+限制连接数
此文章是Nginx的GeoIP2模块和MaxMind国家IP库相互结合,达到客户端IP访问的一个数据记录以及分析,同时还针对一些业务需求做出对Nginx中间件的控制,如:防盗链、防爬虫、限制访问速度、限制连接数等 该篇文章是从一个热爱搞技术的博…...
基于JAVA+SpringBoot+UniApp+Vue的前后端分离的手机移动端图书借阅平台
✌全网粉丝20W,csdn特邀作者、博客专家、CSDN新星计划导师、java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ 🍅文末获取项目下载方式🍅 一、项目背景介绍: 随着社会信息化的快速…...
华为云CodeArts IDE for Java安装使用教程
本篇内容主要介绍使用华为云CodeArts IDE for Java创建工程、代码补全、运行调试代码、Build构建和测试相关的主要功能。 一、下载安装华为云CodeArts IDE for Java 华为云CodeArts IDE for Java安装要求 至少需要 2 GB RAM ,但是推荐8 GB RAM; 至少需要 2.5 GB 硬…...
MPI并行编程技术
MPI并行编程技术 MPI含义及环境搭建安装点对点通信阻塞型接口MPI_SendMPI_Recv 阻塞式示例tag雅可比迭代示例死锁 MPI含义及环境搭建安装 MPICH官网 Github地址 MPI历史版本下载地址 安装教程 MPI介绍 MPI课程 点对点通信 阻塞型接口 MPI_Send MPI_Recv 阻塞式示例 tag 雅…...
使用 pyspark 进行 Classification 的简单例子
This is the second assignment for the Coursera course “Advanced Machine Learning and Signal Processing” Just execute all cells one after the other and you are done - just note that in the last one you have to update your email address (the one you’ve u…...
[ROS2系列] ORBBEC(奥比中光)AstraPro相机在ROS2进行rtabmap 3D建图
目录 背景: 一、驱动AstraPro摄像头 二、安装rtabmap error1:缺包 三、尝试 四、参数讲解 五、运行 error2: Did not receive data since 5 seconds! 六、效果编辑 error4: 背景: 1、设备:pc;jeston agx …...
墨迹天气商业版UTF-8模板,Discuz3.4灰白色风格(带教程)
1.版本支持:Discuzx3.4版本,Discuzx3.3版本,DiscuzX3.2版本。包括网站首页,论坛首页,论坛列表页,论坛内容页,论坛瀑布流,资讯列表页(支持多个),产品列表页(支持多个),关于…...
Godot 官方2D C#重构(2):弹幕躲避
前言 Godot 官方 教程 Godot 2d 官方案例C#重构 专栏 Godot 2d 重构 github地址 实现效果 技术点说明 异步函数 Godot的事件不能在Task中运行,因为会导致跨线程的问题。 //这样是不行的,因为跨线程了,而且会阻塞UI线程,具体原因…...
ELK之LogStash插件grok和geoip的配置使用
本文针对LogStash常用插件grok和geoip的使用进行说明: 一、使用grok输出结构化数据 编辑 first-pipeline.conf 文件,修改为如下内容: input{#stdin{type > stdin}file {# 读取文件的路径path > ["/tmp/access.log"]start_…...
基于Python实现的一款轻量、强大、好用的视频处理软件,可缩视频、转码视频、倒放视频、合并片段、根据字幕裁切片段、自动配字幕等
Quick Cut 是一款轻量、强大、好用的视频处理软件。它是一个轻量的工具,而不是像 Davinci Resolve、Adobe Premiere 那样专业的、复杂的庞然大物。Quick Cut 可以满足普通人一般的视频处理需求:压缩视频、转码视频、倒放视频、合并片段、根据字幕裁切片段…...
深入探讨 Golang 中的追加操作
通过实际示例探索 Golang 中的追加操作 简介 在 Golang 编程领域,append 操作是一种多才多艺的工具,使开发人员能够动态扩展切片、数组、文件和字符串。在这篇正式的博客文章中,我们将踏上一段旅程,深入探讨在 Golang 中进行追加…...
三网话费余额查询的API系统 基于thinkphp6.0框架
本套系统是用thinkphp6.0框架开发的,PHP需大于8.2,系统支持用户中心在线查询和通过API接口对接发起查询,用户余额充值是对接usdt接口,源码全开源,支持懂技术的人二次开发~搭建教程1、源码上传后,吧运行目录…...
LeetCode —— dfs和bfs
797. 所有可能的路径 给你一个有 n 个节点的 有向无环图(DAG),请你找出所有从节点 0 到节点 n-1 的路径并输出(不要求按特定顺序)。 graph[i] 是一个从节点 i 可以访问的所有节点的列表(即从节点 i 到节点…...
【ROS 2 基础-常用工具】-7 Rviz仿真机器人
所有内容请查看:博客学习目录_Howe_xixi的博客-CSDN博客...
循环神经网络(RNN)
定义 循环神经网络(RNN)是一种深度学习神经网络,专门用于处理序列数据,如文本、语音和时间序列数据。RNN的独特之处在于它具有循环连接,允许信息在网络内持续流动,以便处理先前的输入信息,具体…...
ESP32C3 LuatOS TM1650②动态显示累加整数
--注意:因使用了sys.wait()所有api需要在协程中使用 -- 用法实例 PROJECT "ESP32C3_TM1650" VERSION "1.0.0" _G.sys require("sys") local tm1650 require "tm1650"-- 拆分整数,并把最低位数存放在数组最大索引处 loc…...
文心一言 VS 讯飞星火 VS chatgpt (117)-- 算法导论10.3 2题
二、用go语言,对一组同构对象用单数组表示法实现,写出过程ALLOCATE-OBJECT和FREE-OBJECT。 文心一言: 在Go语言中,我们通常使用指针和结构体来表示和操作复杂的数据结构。对于一组同构对象,我们可以使用一个数组来存…...
专业修图软件 Affinity Photo 2 mac中文版编辑功能
Affinity Photo for Mac是应用在MacOS上的专业修图软件,支持多种文件格式,包括psD、PDF、SVG、Eps、TIFF、JPEG等。 Affinity Photo mac提供了许多高级图像编辑功能,如无限制的图层、非破坏性操作、高级的选择工具、高级的调整层、HDR合成、全…...
Excel 5s内导入20w条简单数据(不使用多线程)
文章目录 Excel 5s内导入20w条数据1. 生成20w条数据1.1 使用Excel 宏生成20w条数据1.2 生成成功 2. ExecutorType:批量操作执行器类型2.1 ExecutorType.SIMPLE2.2 ExecutorType.BATCH2.3 ExecutorType.REUSE 3. 20w条数据直接插入数据库3.1 使用ExecutorType.SIMPLE…...
计算机毕业设计 基于SpringBoot笔记记录分享网站的设计与实现 Javaweb项目 Java实战项目 前后端分离 文档报告 代码讲解 安装调试
🍊作者:计算机编程-吉哥 🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。 🍊心愿:点…...
51c自动驾驶~合集58
我自己的原文哦~ https://blog.51cto.com/whaosoft/13967107 #CCA-Attention 全局池化局部保留,CCA-Attention为LLM长文本建模带来突破性进展 琶洲实验室、华南理工大学联合推出关键上下文感知注意力机制(CCA-Attention),…...
MySQL 隔离级别:脏读、幻读及不可重复读的原理与示例
一、MySQL 隔离级别 MySQL 提供了四种隔离级别,用于控制事务之间的并发访问以及数据的可见性,不同隔离级别对脏读、幻读、不可重复读这几种并发数据问题有着不同的处理方式,具体如下: 隔离级别脏读不可重复读幻读性能特点及锁机制读未提交(READ UNCOMMITTED)允许出现允许…...
基于Flask实现的医疗保险欺诈识别监测模型
基于Flask实现的医疗保险欺诈识别监测模型 项目截图 项目简介 社会医疗保险是国家通过立法形式强制实施,由雇主和个人按一定比例缴纳保险费,建立社会医疗保险基金,支付雇员医疗费用的一种医疗保险制度, 它是促进社会文明和进步的…...
Module Federation 和 Native Federation 的比较
前言 Module Federation 是 Webpack 5 引入的微前端架构方案,允许不同独立构建的应用在运行时动态共享模块。 Native Federation 是 Angular 官方基于 Module Federation 理念实现的专为 Angular 优化的微前端方案。 概念解析 Module Federation (模块联邦) Modul…...
NFT模式:数字资产确权与链游经济系统构建
NFT模式:数字资产确权与链游经济系统构建 ——从技术架构到可持续生态的范式革命 一、确权技术革新:构建可信数字资产基石 1. 区块链底层架构的进化 跨链互操作协议:基于LayerZero协议实现以太坊、Solana等公链资产互通,通过零知…...
数据库分批入库
今天在工作中,遇到一个问题,就是分批查询的时候,由于批次过大导致出现了一些问题,一下是问题描述和解决方案: 示例: // 假设已有数据列表 dataList 和 PreparedStatement pstmt int batchSize 1000; // …...
以光量子为例,详解量子获取方式
光量子技术获取量子比特可在室温下进行。该方式有望通过与名为硅光子学(silicon photonics)的光波导(optical waveguide)芯片制造技术和光纤等光通信技术相结合来实现量子计算机。量子力学中,光既是波又是粒子。光子本…...
在Ubuntu24上采用Wine打开SourceInsight
1. 安装wine sudo apt install wine 2. 安装32位库支持,SourceInsight是32位程序 sudo dpkg --add-architecture i386 sudo apt update sudo apt install wine32:i386 3. 验证安装 wine --version 4. 安装必要的字体和库(解决显示问题) sudo apt install fonts-wqy…...
基于IDIG-GAN的小样本电机轴承故障诊断
目录 🔍 核心问题 一、IDIG-GAN模型原理 1. 整体架构 2. 核心创新点 (1) 梯度归一化(Gradient Normalization) (2) 判别器梯度间隙正则化(Discriminator Gradient Gap Regularization) (3) 自注意力机制(Self-Attention) 3. 完整损失函数 二…...
CSS | transition 和 transform的用处和区别
省流总结: transform用于变换/变形,transition是动画控制器 transform 用来对元素进行变形,常见的操作如下,它是立即生效的样式变形属性。 旋转 rotate(角度deg)、平移 translateX(像素px)、缩放 scale(倍数)、倾斜 skewX(角度…...
