编译安装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制作。做自己喜欢的事,生活就是快乐的。 🍊心愿:点…...
【Axure高保真原型】引导弹窗
今天和大家中分享引导弹窗的原型模板,载入页面后,会显示引导弹窗,适用于引导用户使用页面,点击完成后,会显示下一个引导弹窗,直至最后一个引导弹窗完成后进入首页。具体效果可以点击下方视频观看或打开下方…...
React Native 开发环境搭建(全平台详解)
React Native 开发环境搭建(全平台详解) 在开始使用 React Native 开发移动应用之前,正确设置开发环境是至关重要的一步。本文将为你提供一份全面的指南,涵盖 macOS 和 Windows 平台的配置步骤,如何在 Android 和 iOS…...
srs linux
下载编译运行 git clone https:///ossrs/srs.git ./configure --h265on make 编译完成后即可启动SRS # 启动 ./objs/srs -c conf/srs.conf # 查看日志 tail -n 30 -f ./objs/srs.log 开放端口 默认RTMP接收推流端口是1935,SRS管理页面端口是8080,可…...
实现弹窗随键盘上移居中
实现弹窗随键盘上移的核心思路 在Android中,可以通过监听键盘的显示和隐藏事件,动态调整弹窗的位置。关键点在于获取键盘高度,并计算剩余屏幕空间以重新定位弹窗。 // 在Activity或Fragment中设置键盘监听 val rootView findViewById<V…...
【Oracle】分区表
个人主页:Guiat 归属专栏:Oracle 文章目录 1. 分区表基础概述1.1 分区表的概念与优势1.2 分区类型概览1.3 分区表的工作原理 2. 范围分区 (RANGE Partitioning)2.1 基础范围分区2.1.1 按日期范围分区2.1.2 按数值范围分区 2.2 间隔分区 (INTERVAL Partit…...
RNN避坑指南:从数学推导到LSTM/GRU工业级部署实战流程
本文较长,建议点赞收藏,以免遗失。更多AI大模型应用开发学习视频及资料,尽在聚客AI学院。 本文全面剖析RNN核心原理,深入讲解梯度消失/爆炸问题,并通过LSTM/GRU结构实现解决方案,提供时间序列预测和文本生成…...
OPENCV形态学基础之二腐蚀
一.腐蚀的原理 (图1) 数学表达式:dst(x,y) erode(src(x,y)) min(x,y)src(xx,yy) 腐蚀也是图像形态学的基本功能之一,腐蚀跟膨胀属于反向操作,膨胀是把图像图像变大,而腐蚀就是把图像变小。腐蚀后的图像变小变暗淡。 腐蚀…...
Typeerror: cannot read properties of undefined (reading ‘XXX‘)
最近需要在离线机器上运行软件,所以得把软件用docker打包起来,大部分功能都没问题,出了一个奇怪的事情。同样的代码,在本机上用vscode可以运行起来,但是打包之后在docker里出现了问题。使用的是dialog组件,…...
CSS设置元素的宽度根据其内容自动调整
width: fit-content 是 CSS 中的一个属性值,用于设置元素的宽度根据其内容自动调整,确保宽度刚好容纳内容而不会超出。 效果对比 默认情况(width: auto): 块级元素(如 <div>)会占满父容器…...
C++使用 new 来创建动态数组
问题: 不能使用变量定义数组大小 原因: 这是因为数组在内存中是连续存储的,编译器需要在编译阶段就确定数组的大小,以便正确地分配内存空间。如果允许使用变量来定义数组的大小,那么编译器就无法在编译时确定数组的大…...
