当前位置: 代码迷 >> 综合 >> ubuntu 16.04搭建Nginx+ Modsecurity
  详细解决方案

ubuntu 16.04搭建Nginx+ Modsecurity

热度:38   发布时间:2024-03-05 22:22:18.0
1.安装依赖环境
apt-get install apache2-dev autoconf automake build-essential bzip2 checkinstall devscripts flex g++ gcc git graphicsmagick-imagemagick-compat graphicsmagick-libmagick-dev-compat libaio-dev libaio1 libass-dev libatomic-ops-dev libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libbz2-dev libcdio-cdda1 libcdio-paranoia1 libcdio13 libcurl4-openssl-dev libfaac-dev libfreetype6-dev libgd-dev libgeoip-dev libgeoip1 libgif-dev libgpac-dev libgsm1-dev libjack-jackd2-dev libjpeg-dev libjpeg-progs libjpeg8-dev liblmdb-dev libmp3lame-dev libncurses5-dev libopencore-amrnb-dev libopencore-amrwb-dev libpam0g-dev libpcre3 libpcre3-dev libperl-dev libpng12-dev libpng12-0 libpng12-dev libreadline-dev librtmp-dev libsdl1.2-dev libssl-dev libssl1.0.0 libswscale-dev libtheora-dev libtiff5-dev libtool libva-dev libvdpau-dev libvorbis-dev libxml2-dev libxslt-dev libxslt1-dev libxslt1.1 libxvidcore-dev libxvidcore4 libyajl-dev make openssl perl pkg-config tar texi2html unzip zip zlib1g-dev
2.下载ModSecurity
Git克隆ModSecurity,检出并构建libmodsecurity
cd /usr/local
git clone https://github.com/SpiderLabs/ModSecurity
cd ModSecurity
git checkout -b v3/master origin/v3/master
sh build.sh
git submodule init
git submodule update
./configure 
make
make install若执行make时报错
/usr/bin/ld: cannot find -llua5.2
collect2: error: ld returned 1 exit status
则需要先安装lua5.1(自行百度)
然后查看locate lua是否有liblua5.2.so.0 
然后做软连接 
ln -s liblua5.2.so.0 liblua5.2.so
然后重新编译(不做赘述)
3.Git克隆Modsecurity-nginx连接器
cd /usr/local
git clone https://github.com/SpiderLabs/ModSecurity-nginx.git
  相关解决方案