源文件null脚本安装Nginx并添加Naxsi模块

首先声明,我是一个菜鸟。一下文章中出现技术误导情况盖不负责

    #!/bin/bash

    user="`whoami`"

    if [ "$user" != "root" ];then

    echo "execute $0 with root !!! "

    exit 0;

    fi

    sed -i 's/^exclude/#exclude/'  /etc/yum.conf && yum -y install gcc && sed -i 's/^#exclude/exclude/'  /etc/yum.conf

    #获得源文件

    yum -y install gcc gcc-c++ autoconf automake make

    yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel

    cp ./nginx.txt /tmp/

    cp ./conf /tmp/ -r

    cd /tmp

    if [ ! -f "nginx-1.2.0.tar.gz" ];then

    echo "Downloading http://nginx.org/download/nginx-1.2.0.tar.gz!!!"

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

    fi

    tar -zxvf nginx-1.2.0.tar.gz

    if [ ! -f "ngx_cache_purge-1.3.tar.gz" ];then

    echo "http://labs.frickle.com/files/ngx_cache_purge-1.3.tar.gz!!!"

    wget http://labs.frickle.com/files/ngx_cache_purge-1.3.tar.gz

    fi

    tar -zxvf ngx_cache_purge-1.3.tar.gz

    if [ ! -f "pcre-8.10.tar.gz" ];then

    echo "Downloading http://webserver.googlecode.com/files/pcre-8.10.tar.gz!!!"

    wget http://webserver.googlecode.com/files/pcre-8.10.tar.gz

    fi

    tar -zxvf pcre-8.10.tar.gz

    if [ ! -f "openssl-1.0.0c.tar.gz" ];then

    echo "Downloading http://www.openssl.org/source/openssl-1.0.0c.tar.gz!!!"

    wget http://www.openssl.org/source/openssl-1.0.0c.tar.gz

    fi

    tar -zxvf openssl-1.0.0c.tar.gz

    if [ ! -f "gperftools-2.0.tar.gz" ];then

    echo "https://gperftools.googlecode.com/files/gperftools-2.0.tar.gz!!!"

    wget https://gperftools.googlecode.com/files/gperftools-2.0.tar.gz

    fi

    tar -zxvf gperftools-2.0.tar.gz

    cd gperftools-2.0

    ./configure --prefix=/usr

    make&&make install

    每日一道理
岭上娇艳的鲜花,怎敌她美丽的容颜?山间清澈的小溪,怎比她纯洁的心灵?

    echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf

    /sbin/ldconfig

    mkdir /tmp/tcmalloc

    chmod 0777 /tmp/tcmalloc

    mkdir /usr/local/nginx

    cd /usr/local/nginx

    wget https://naxsi.googlecode.com/files/naxsi-0.47.tgz

    if [ $? -eq 0 ]

    then

    tar xvzf naxsi-0.47.tgz

    rm -rf naxsi-0.47.tgz

    else

    echo "Downloading https://naxsi.googlecode.com/files/naxsi-0.47.tgz failured !!!"

    exit 1

    fi

    rm -rf naxsi-0.47.tgz

    mv naxsi-0.47 naxsi

    #change file before compile

    sed -i 's/\"nginx/\"firefoxbug/i' /tmp/nginx-1.2.0/src/core/nginx.h

    #sed -i 's/\" NGINX_VER \"/SecOn/' /tmp/nginx-1.2.0/src/http/ngx_http_special_response.c

    sed 's/>nginx</>firefoxbug</' -i /tmp/nginx-1.2.0/src/http/ngx_http_special_response.c

    #complie nginx with new args

    groupadd www

    useradd -g www -s /bin/false -M www

    cd /tmp/nginx-1.2.0

    ./configure --user=www --group=www  --prefix=/usr/local/nginx --with-pcre=../pcre-8.10 --with-openssl=../openssl-1.0.0c --add-module=../ngx_cache_purge-1.3 --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --without-mail_pop3_module     --without-mail_smtp_module     --without-mail_imap_module     --without-http_uwsgi_module     --without-http_scgi_module --with-google_perftools_module --add-module=/usr/local/nginx/naxsi/naxsi_src/

    make && make install

    if [ $? -ne 0 ];then

    echo "error"

    exit 1

    fi

    #set auto start scripts

    cp /tmp/nginx.txt /etc/init.d/nginx

    chmod u+x /etc/init.d/nginx

    chkconfig --add nginx

    chkconfig --level 345 nginx on

    chkconfig --list nginx

    service nginx start

    # set nginx + nassi

    rm -rf /usr/local/nginx/conf

    mv /tmp/conf /usr/local/nginx/

    mkdir /home/cache/

    mkdir /home/logs/

    service nginx reload

文章结束给大家分享下程序员的一些笑话语录:

祝大家在以后的日子里. 男生象Oracle般健壮; 女生象win7般漂亮; 桃花运象IE中毒般频繁; 钱包如Gmail容量般壮大, 升职速度赶上微软打补丁 , 追女朋友像木马一样猖獗, 生活像重装电脑后一样幸福, 写程序敲代码和聊天一样有**。

原文链接: https://www.cnblogs.com/xinyuyuanm/archive/2013/05/18/3085853.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    源文件null脚本安装Nginx并添加Naxsi模块

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/89074

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月9日 下午11:57
下一篇 2023年2月9日 下午11:57

相关推荐