Skip to content

Instantly share code, notes, and snippets.

@dcnl1980
Created November 28, 2016 22:00
Show Gist options
  • Save dcnl1980/eaba5da5abf91d9cb76490c54d32880c to your computer and use it in GitHub Desktop.
Save dcnl1980/eaba5da5abf91d9cb76490c54d32880c to your computer and use it in GitHub Desktop.

Revisions

  1. dcnl1980 created this gist Nov 28, 2016.
    39 changes: 39 additions & 0 deletions nginx-naxsi.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    #!/usr/bin/env bash

    apt-get install -y libpcre3 libpcre3-dev libssl-dev unzip make \
    libgoogle-perftools-dev google-perftools jq
    mkdir /tmp/ngxbuild
    cd /tmp/ngxbuild
    latestNginx=$(curl -s http://hg.nginx.org/nginx/tags |
    grep "^ *release-" | head -1 | cut -c 9-)
    latestNaxsi=$(curl -s https://api.github.com/repos/nbs-system/naxsi/releases |
    jq -r .[].tag_name | grep -v rc | head -1)
    wget -q http://nginx.org/download/nginx-${latestNginx}.tar.gz
    wget -q https://github.com/nbs-system/naxsi/archive/${latestNaxsi}.tar.gz
    tar xzf nginx-${latestNginx}.tar.gz
    tar xzf ${latestNaxsi}.tar.gz
    cd nginx*
    ./configure --conf-path=/etc/nginx/nginx.conf \
    --add-module=../naxsi-${latestNaxsi}/naxsi_src/ \
    --error-log-path=/var/log/nginx/error.log \
    --http-client-body-temp-path=/var/lib/nginx/body \
    --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
    --http-log-path=/var/log/nginx/access.log \
    --http-proxy-temp-path=/var/lib/nginx/proxy \
    --lock-path=/var/lock/nginx.lock \
    --pid-path=/var/run/nginx.pid \
    --with-http_ssl_module \
    --with-http_v2_module \
    --with-http_realip_module \
    --with-stream \
    --with-stream_realip_module \
    --with-stream_ssl_module \
    --with-google_perftools_module \
    --without-mail_pop3_module \
    --without-mail_smtp_module \
    --without-mail_imap_module \
    --without-http_uwsgi_module \
    --without-http_scgi_module \
    --prefix=/usr
    make -j 4
    make install