Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Nginx compiled with ModSecurity (with JSON Support)
## OS Ubuntu 17.10
## Pre-Requisites
# apt-get install -y git build-essential libpcre3 libpcre3-dev libssl-dev libtool autoconf apache2-dev libxml2-dev libcurl4-openssl-dev automake pkgconf dialog apt-utils
# apt-get install -y g++ flex bison curl doxygen libyajl-dev libgeoip-dev libtool dh-autoreconf libcurl4-gnutls-dev libxml2 libpcre++-dev libxml2-dev libyajl2 yajl-tools
# apt-get install -y libgd2-xpm-dev libgeoip-dev libpam-dev libpcre3 libpcre3-dev google-perftools libgoogle-perftools-dev libatomic-ops-dev libperl-dev
# export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/x86_64-linux-gnu/pkgconfig
## ModSecurity
# cd /usr/src
# git clone -b nginx_refactoring https://github.com/SpiderLabs/ModSecurity.git
# cd ModSecurity/
# ./autogen.sh
# ./configure --enable-standalone-module --disable-mlogc --with-yajl="/usr/local/lib /usr/local"
# make
## Nginx
# cd /usr/src
# curl -LO http://nginx.org/download/nginx-1.13.0.tar.gz
# tar xf nginx-1.13.0.tar.gz && cd nginx-1.13.0
# groupadd -r nginx
# useradd -r -g nginx -s /sbin/nologin -M nginx
# ./configure --user=nginx \
--group=nginx \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.con \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-select_module \
--with-poll_module \
--with-threads \
--with-file-aio \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-http_geoip_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_stub_status_module \
--with-http_perl_module \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_ssl_module \
--with-google_perftools_module \
--with-cpp_test_module \
--with-pcre \
--with-pcre-jit \
--with-libatomic \
--with-debug \
--add-module=/usr/src/ModSecurity/nginx/modsecurity
# make
# make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment