博文精选 | Nginx 新增模块 more_clear_headers 问题记录
2022-04-25 17:24:34
F5小安
文章速览:
行业:互联网
关键字:Nginx、模块、编译
摘要:Nginx 新增模块 more_clear_headers 问题记录
阅读时长:5分钟
以下文章来源于InfoQ!作者:风翱
问题:nginx: [emerg] unknown directive “more_clear_headers” in /usr/local/nginx/conf/nginx.conf:374
新增模块 more_clear_headers 的处理步骤:
1、查看 nginx 编译时安装的模块
/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.10.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
built with OpenSSL 1.0.1g 7 Apr 2014
TLS SNI support enabled
configure arguments: –user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module –with-http_gzip_static_module –with-pcre=/home/temp/pcre-8.37 –with-zlib=/home/temp/zlib-1.2.8 –with-openssl=/home/temp/openssl-1.0.1g
2、添加新的模块 headers-more-nginx-module-0.29
cd /home/temp/nginx-1.10.1
./configure –user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module –with-http_gzip_static_module –with-pcre=/home/temp/pcre-8.37 –with-zlib=/home/temp/zlib-1.2.8 –with-openssl=/home/temp/openssl-1.0.1g –add-module=/mnt/headers-more-nginx-module-0.29
make (很重要) (注意不是make install,这个命令是覆盖安装)
3、备份原有 nginx,重新拷贝 nginx
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx20180208
cp ./objs/nginx /usr/local/nginx/sbin/
另:
1、报错 nginx: [emerg] host not found in upstream “test.xxx.com”
in /usr/local/nginx/vhosts/test.xxx.com.conf:12
原因:nginx 配置语法上没有错误,是系统无法解析这个域名。
解决方法:
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 test.xxx.com
以上是针对Nginx 新增模块问题的分享,希望对大家有帮助!
声明:本文章版权归原作者及原出处所有 。凡本社区注明“来源:XXX或转自:XXX”的作品均转载自其它媒体,转载目的在于传递分享更多知识,内容为作者个人观点,仅供参考,并不代表本社区赞同其观点和对其真实性负责。本社区转载的文章,我们已经尽可能的对作者和来源进行了注明,若因故疏忽,造成漏注,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本社区拥有对此声明的最终解释权。
发布评论 加入社群
相关文章

博文精选 | nginx 性能优化 -- 配置解析
F5小安
2022-07-21 10:35:06 512

博文精选 | 漫画 Nginx 的 subfilter
F5小安
2022-05-27 13:57:18 409

博文精选 | 一篇文章搞定 Nginx 反向代理与负载均衡
F5小安
2022-05-26 10:31:14 917

回复评论
发布评论