已安装nginx后添加headers-master模块

2020-09-23  本文已影响0人  ArthurIsUsed

问题

nginx迁移过去后,新服务器上提示以下错误。

[root@nginx02 conf]# nginx -t
nginx: [emerg] unknown directive "more_set_headers" in /usr/local/nginx/conf/nginx.conf:23
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

查阅后得知,缺少header_more模块,但此模块不是nginx自带,需要另外安装。可。

解决

[root@nginx01 opt]# wget https://github.com/openresty/headers-more-nginx-module/archive/master.zip
[root@nginx01 opt]# unzip master.zip
[root@-nginx01 nginx-1.12.1]# ./configure  --prefix=/usr/local/nginx  --with-http_stub_status_module --with-http_ssl_module --with-file-aio --with-http_realip_module --add-module=/opt/headers-more-nginx-module-master
[root@nginx01 nginx-1.12.1]# make
[root@nginx01 objs]# ./nginx  -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@kmzyw-nginx01 objs]# pwd
/usr/local/src/nginx-1.12.1/objs
[root@nginx01 objs]# cp nginx /usr/local/nginx/sbin/nginx 
cp: overwrite ‘/usr/local/nginx/sbin/nginx’? yes
[root@nginx01 objs]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
上一篇 下一篇

猜你喜欢

热点阅读