安装debian的nginx
安装教程参考:https://blog.csdn.net/ShouZhuoFengFengSh/article/details/108411933 https://www.cnblogs.com/wzxmt/p/12379847.html
HttpHeadersModule模块 (headers-more-nginx-module-master)--跨域
做操作前注意备份一份全量的配置文件,最重要的是nginx.conf文件
cp -r /usr/local/nginx /usr/local/nginxbak
开始添加:
root@VM-0-16-debian:/data# pwd /data 下载模块 wget https://codeload.github.com/openresty/headers-more-nginx-module/zip/master 解压 unzip master 解压出来是一个文件夹 headers-more-nginx-module-master 编译安装 ./configure --prefix=/usr/local/nginx --add-module=/data/headers-more-nginx-module-master make && make install 停掉NGINX cd /usr/local/nginx/sbin/ ./nginx -s stop 重启nginx ./nginx -s reload 查看已经安装添加的模块 ./nginx -V 结果:
root@VM-0-16-debian:/usr/local/nginx/sbin# ./nginx -V
nginx version: nginx/1.16.1
built by gcc 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
configure arguments: --prefix=/usr/local/nginx --add-module=/data/headers-more-nginx-module-master