zoukankan      html  css  js  c++  java
  • 源文件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容量般壮大, 升职速度赶上微软打补丁 , 追女朋友像木马一样猖獗, 生活像重装电脑后一样幸福, 写程序敲代码和聊天一样有**。

  • 相关阅读:
    【HDU 4305】Lightning(生成树计数)
    【HDU 1150】Machine Schedule(二分图匹配)
    【HDU 2063】过山车(二分图匹配)
    透过Nim游戏浅谈博弈
    [SCOI2010]字符串
    [SCOI2010]传送带[三分]
    [SCOI2010]序列操作[分块or线段树]
    HDU 5306 Gorgeous Sequence[线段树区间最值操作]
    1455: 罗马游戏[左偏树or可并堆]
    Codevs 5914 [SXOI2016]最大值
  • 原文地址:https://www.cnblogs.com/xinyuyuanm/p/3085853.html
Copyright © 2011-2022 走看看