惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
Google Developers Blog
博客园 - 司徒正美
J
Java Code Geeks
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
D
Docker
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
腾讯CDC
V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Check Point Blog
M
MIT News - Artificial intelligence
Jina AI
Jina AI
I
InfoQ
雷峰网
雷峰网
The Cloudflare Blog
美团技术团队
Engineering at Meta
Engineering at Meta

博客园 - 黑米

卸载 nodejs 时报错 you must be an administrator to remove this application 的解决 真心觉得,WIN11就是一个笑话 rabbitmqctl set_permissions 报错 invalid command centos7 升级 openssh (用来避坑) 你见过最长的类名是什么 记一次 k8s master 节点被 reset 后恢复的过程 java.lang.UnsupportedOperationException: null 解决 calico/node is not ready: BIRD is not ready: BGP not established with 的问题 @Transactional 和 @DSTransactional 混用可能会造成事务死锁 问题解决:idea 中无法连接 sql server 数据库,报错 [08S01] 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接 用一个脚本定时清理被驱逐的pod java 里的正则表达式 为何实现了 Filter 的类,能自动添加到 filterChain 中? 如何正确填写 sonar.java.binaries 解决 Tasks support was removed in SonarQube 7.6. 的问题 部署了 prometheus, 在 target 中显示 cadvisor 与 nodes 的状态都是 down k8s 部署了 redis 集群,节点重启后,ip 变化导致集群不可用的问题 mvn deploy 到 nexus,报错 Return code is: 400, ReasonPhrase: Bad Request 关于 mybatis 的 @MapperScan 用法心得
为 centos7 编译 nginx
黑米 · 2022-12-04 · via 博客园 - 黑米

通过 yum 安装的 nginx 版本多数是 1.22.x,已经被暴露出有一个高危的安全漏洞(CVE-2022-3638)。需要自行编译安装最新的 1.23.2 以修复这个安全问题。

源码好下载,编译命令也简单,configure, make 就能行。难在如何配置 configure 参数。我们希望编译出来的 nginx ,替换掉默认的 nginx 可执行程序(位于 /usr/sbin/ 下)就能简单地完成升级,而不用再改一堆复杂配置。默认的 nginx 是通过系统服务启动的,也不想做改动,所以,最好能知道默认的 nginx 编译时使用了哪些参数,基于它进行编译就没问题。

首先当然是上网学习了。好吧,学习效果一般,都是教你怎么把 nginx 安装到 /usr/local/ 下,再修改一堆复杂的配置,做法不够简单,可能还会有一些问题(比如说 user, group 就不是 nginx)。

实际上,只要先通过 yum 安装了 nginx, 再输入命令 nginx -V, 就可以直接看到当时编译时用的参数。用它用为编译的参数不就行了么。

这是编译参数:

./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie' --add-module=headers-more-nginx-module

后面的 --add-module=headers-more-nginx-module 是新增额外要编译的模块,不用的话也可以去掉。

成功后直接运行 make.

然后把编译后的可执行文件替换掉原文件。再重启服务即可。

cp objs/nginx /usr/sbin/
systemctl restart nginx

这时候再用 nginx -V 检查版本号已经升级了。

够简单吧。