Skip to content

Instantly share code, notes, and snippets.

@udomsak
Created August 22, 2016 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save udomsak/8fdc1892a5ef34a2a63552c056a409ca to your computer and use it in GitHub Desktop.
Save udomsak/8fdc1892a5ef34a2a63552c056a409ca to your computer and use it in GitHub Desktop.
#!/bin/bash
NGINX_VERSION=1.11.3
NAXSI_VERSION="master"
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget python-pip python-geoip logtail curl \
gcc make libpcre3-dev libssl-dev \
supervisor libgeoip-dev
cd /usr/local/ && \
wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" && \
wget "https://github.com/nbs-system/naxsi/archive/${NAXSI_VERSION}.tar.gz" && \
tar zxvf nginx-${NGINX_VERSION}.tar.gz && \
tar zxvf ${NAXSI_VERSION}.tar.gz
cd /usr/local/nginx-${NGINX_VERSION}/ && \
./configure \
--prefix=/usr/local/nginx/ \
--conf-path=/etc/nginx/nginx.conf --add-module=../naxsi-${NAXSI_VERSION}/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 \
--without-mail_pop3_module --without-mail_smtp_module \
--without-mail_imap_module --without-http_uwsgi_module \
--with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module \
--with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module \
--with-http_secure_link_module --with-http_auth_request_module \
--with-threads --with-stream --with-stream_ssl_module \
--with-http_geoip_module --with-http_v2_module --with-http_stub_status_module --with-http_slice_module --with-http_auth_request_module \
--without-http_scgi_module --with-ipv6 && \
make && \
make install
cd /usr/local/naxsi-${NAXSI_VERSION} && \
cp naxsi_config/naxsi_core.rules /etc/nginx/ && \
cd nxapi && \
pip install -r requirements.txt && \
python setup.py install
mkdir mkdir -pv /etc/nginx/naxsi_rules.d/
cd /etc/nginx/naxsi_rules.d/
wget https://raw.githubusercontent.com/nbs-system/naxsi-rules/master/wordpress.rules wordpress.rules
rm /usr/local/master*
rm /usr/local/naxsi* -rf
rm /usr/local/nginx-${NGINX_VERSION}* -rf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment