一,nginx 安装布署
     
    1,nginx下载
     
    wget  http://nginx.org /download/nginx-1.9.9.tar.gz
    先 安装pcre,libevent,  OpenSSL
    >yum install pcre*
    >yum install libevent*
    >yum install openssl*
     
    解压nginx,进入目录。
    > ./configure    --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module    --with-pcre=pcre源目录
    pcre 指向源文件目录,而不是编译后的目录

                            # --with-http_stub_status_module:这个模块用于获取nginx自上次启动以来的工作状态,非核心模块

                           # --with-http_ssl_module     :HTTPS 使用

                         

     

    > make && make install

    pcre-7.8-7.el6.x86_64
    pcre-devel-7.8-7.el6.x86_64
    pcre-static-7.8-7.el6.x86_64

    代理配置

      proxy_redirect off ;
                 proxy_set_header Host $host;
                 proxy_set_header X-Real-IP $remote_addr;
                 proxy_set_header REMOTE-HOST $remote_addr;
                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                 client_max_body_size 50m;
                 client_body_buffer_size 256k;
                 proxy_connect_timeout 30;
                 proxy_send_timeout 30;
                 proxy_read_timeout 60;
                 proxy_buffer_size 256k;
                 proxy_buffers 4 256k;
                 proxy_busy_buffers_size 256k;
                 proxy_temp_file_write_size 256k;
                 proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
                 proxy_max_temp_file_size 128m;

     

            2.1 pcre 编译安装  安装pcre 让nginx支持rewrite 方便以后所需

     

            wget ftp://ftp.csx.cam.ac.uk/ /pub/software/programming/pcre/pcre-8.37.tar.gz
            tar zxvf pcre-8.37.tar.gz
            cd pcre-8.37/
            ./configure --prefix=/usr/local/pcre
    编译完后可以执行make check进行测试(这一步非必须)
            make
    1. Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library  
    2. Testing pcregrep newline settings  
    3. PASS: RunGrepTest  
    4. ==================  
    5. All 5 tests passed  
    6. ==================  
    7. make[2]: Leaving directory `/usr/local/pcre-8.32'  
    8. make[1]: Leaving directory `/usr/local/pcre
        加上对utf-8的支持可以在./configuration时加上参数: ./configure --enable-utf8  
    make install
     
    nginx -t -c /usr/local/nginx/conf/nginx.conf
     
        2.2 libevent 编译安装

            # wget  http://www.monkey.org/~provos/libevent-2.0.12-stable.tar.gz
            # tar zxf libevent-2.0.12-stable.tar.gz 
            # cd libevent-2.0.12-stable
            #./configure   --prefix= /usr/local/lib
            # make && make install
         
    联系QQ:343886028 --加QQ群 145315854