大网数据广告活动
服务器运维问答

Nginx and Modsec version mismatch

· 52CE 我爱测

I have installed nginx and modsec roughly following this tutorial https://www.linuxcapable.com/how-to-install-modsecurity-with-nginx-on-ubuntu-20-04/ . After a couple of months working perfectly I am now getting this error: nginx…

问题原文

原帖链接 · andygozindy · CC BY-SA 4.0

I have installed nginx and modsec roughly following this tutorial https://www.linuxcapable.com/how-to-install-modsecurity-with-nginx-on-ubuntu-20-04/.

After a couple of months working perfectly I am now getting this error:

nginx: [emerg] module "/usr/share/nginx/modules/ngx_http_modsecurity_module.so" version 1021004 instead of 1021006 in /etc/nginx/nginx.conf:5
nginx: configuration file /etc/nginx/nginx.conf test failed

I haven't rebuilt the nginx connector module yet, but I expect this is the problem and once I have rebuilt and installed the module, nginx will restart again without a problem. UPDATE: Rebuilt the module and all is working well.

So my question is: How to manage this situation on a production server?. What I mean is when the system updates & upgrades, at some point nginx version will be ahead of the nginx modsec connector module version and the server will not reload....and therefore the server will stop working (as happened just now).

已采纳解答

原帖链接 · andygozindy · CC BY-SA 4.0

My best solution to this problem (if you are using Ubuntu or Debian) is to make an exception in unattended-upgrades for nginx so that it doesn't automatically upgrade. Regularly check to see if there are any updates to nginx and if there is then rebuild the connector before installing nginx updates.......that's the best I can offer. No-one else answered, so this is the accepted answer ;-)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-04-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。