Nginx 新增模块 more_clear_headers 问题记录
问题: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
版权声明: 本文为 InfoQ 作者【风翱】的原创文章。
原文链接:【http://xie.infoq.cn/article/79964a178315b0cbf6c033d2b】。
本文遵守【CC-BY 4.0】协议,转载请保留原文出处及本版权声明。
评论