//
xiaoaoaode
Published on 2021-05-20 / 210 Visits
0

云锁nginx编译配置

需要下载的额外的包:

apt-get install libpcre3 libpcre3-dev
apt-get install openssl libssl-dev
apt-get install libxml2 libxml2-dev
apt-get install libxslt-dev
apt-get install -y libgd-dev

简写:
apt install libpcre3 libpcre3-dev openssl libssl-dev libxml2 libxml2-dev libxslt-dev libgd-dev

其他基本操作见Nginx/Tengine 自编译说明 (yunsuo.com.cn)

1.18.0(Ubuntu 20.04)编译小结

  1. 执行ps -elf | grep nginx,获得nginx的地址

  2. 备份nginx

    cd /usr/sbin/

    cp nginx nginx.bak

  3. 获得原nginx的配置信息

    nginx -V

  4. 下载解压nginx-1.18.0.tar.gznginx-plugin-master.zip

    cd ~

    wget http://nginx.org/download/nginx-1.18.0.tar.gz

    tar zxvf nginx-1.18.0.tar.gz

    wget https://codeload.github.com/yunsuo-open/nginx-plugin/zip/master -O nginx-plugin-master.zip

    unzip nginx-plugin-master.zip (可能需要安装unzip)

  5. 获得nginx-plugin-master的绝对地址

    cd nginx-plugin-master/

    pwd

  6. 配置nginx

    cd nginx-1.18.0/

    ./configure (之前nginx -V得到的) --add-module=/root/nginx-plugin-master

  7. 修改Makefile文件

    VIM objs/Makefile

    在Makefile文件中的CFLAGS=后追加宏定义 -DHIGHERTHAN8

  8. 修改ngx_modules.c文件

    &ngx_http_yunsuo_module,向下移动到ngx_http_userid_filter_modulengx_http_headers_filter_module之间。

  9. 编译nginx

    make

  10. 替换原nginx

    rm -rf /usr/sbin/nginx
    cp objs/nginx /usr/sbin/nginx
    service nginx restart