nginx 新增模块缺失,
nginx: [emerg] unknown directive "more_clear_headers"
https://blog.csdn.net/chunyuan314/article/details/81737303
安装
https://github.com/openresty/headers-more-nginx-module
cd /usr/local/src
wget https://github.com/openresty/headers-more-nginx-module/archive/v0.33.tar.gz
tar -xzvf v0.33.tar.gz
cd headers-more-nginx-module-0.33
新增模块
# 先准备曾经的配置,找到 configure arguments 后边的配置。
nginx -V
# 找到曾经的包文件
cd /usr /local/src/nginx
# 再配置后追加 add-module 指向headers-more-nginx-module-0.33
./configure --user=nginx --group=nginx --prefix=/alidata/service/nginx --pid-path=/alidata/service/nginx/run/nginx.pid --with-http_stub_status_module --with-threads --with-file-aio --with-pcre-jit --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_realip_module --with-http_addition_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_realip_module --with-http_slice_module --with-pcre --with-openssl=/usr/local/src/base/1-openssl/openssl-1.1.1f --with-openssl-opt=enable-tls1_3 --add-module=/opt/ngx_brotli/ --add-module=/usr/local/src/nginx/headers-more-nginx-module-0.33
# 再make (千万不要 make install)
make
# 然后复制 nginx 文件覆盖之前安装包里的 nginx 文件,覆盖安装之前 ,先备份一个
nginx stop
cp /alidata/service/nginx/sbin/nginx /alidata/service/nginx/sbin/nginx.back
cp -r objs/nginx /alidata/service/nginx/sbin/nginx
# 启动
/alidata/service/nginx/sbin/nginx
参考
https://segmentfault.com/a/1190000018418253?utm_source=coffeephp.com