• nginx安装


    安装NGINX

    yum install -y gcc openssl-devel pcre-devel
     
    mkdir -p /usr/local/nginx/html
     
    tar -xf tengine-2.1.2.tar.gz
    cd tengine-2.1.2
    ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module
     
    make:
    make install
    

      

    修改配置文件

    #user  ops;
    worker_processes  auto;
    worker_cpu_affinity auto;
     
    error_log  logs/error.log  error;
     
    pid        logs/nginx.pid;
     
    worker_rlimit_nofile 65535;
     
    events {
        use epoll;
        worker_connections  65535;
    }
     
     
    http {
        include       mime.types;
        default_type  application/octet-stream;
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
     
        log_format  json  '{"@timestamp":"$time_iso8601",'
                          '"remote_addr":"$remote_addr",'
                          '"remote_user":"$remote_user",'
                          '"http_host":"$http_host",'
                          '"request":"$request",'
                          '"status":"$status",'
                          '"body_bytes_sent":$body_bytes_sent,'
                          '"http_referer":"$http_referer",'
                          '"http_user_agent":"$http_user_agent",'
                          '"http_x_frowarded_for":"$http_x_forwarded_for",'
                  '"upstream_status":"$upstream_status",'
                          '"upstream_addr":"$upstream_addr",'
                          '"upstream_response_time":"$upstream_response_time",'
                          '"request_time":$request_time}';
     
     
        access_log  logs/access.log  json;
     
        sendfile        on;
        #tcp_nopush     on;
     
        keepalive_timeout  65;
     
        client_header_buffer_size    20m;
        large_client_header_buffers  4 2048k;
        client_max_body_size 20m;
        proxy_buffer_size 64k;
        proxy_buffers   4 32k;
        proxy_busy_buffers_size 64k;
        proxy_temp_file_write_size 64k;
     
        proxy_ignore_client_abort  on;  #让代理服务端不要主动关闭客户端的连接。
     
        gzip  on;
        gzip_min_length 1k;
        gzip_buffers 4 16k;
        gzip_http_version 1.1;
        gzip_comp_level 2;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/jpeg image/gif image/png application/javascript;
        gzip_proxied any;
        gzip_disable "MSIE [1-6].";
     
    server {
            listen 80 default;
            server_name _;
            return 499;
            }
     
    include /usr/local/nginx/conf/vhosts/*.conf;
    }
    

      

    添加配置文件xx.conf

    # cd /usr/local/nginx/conf/vhosts/
    # vim xx.conf
    
    upstream xx {
            server ip:port weight=4 max_fails=2 fail_timeout=30s;
            server ip:port weight=4 max_fails=2 fail_timeout=30s;
    }
    
    server {
    	listen  80;
            server_name  _;
            access_log  logs/xx.log json;
    
        location / {
            proxy_pass         http://xx;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_connect_timeout   10s;
            proxy_send_timeout      150s;
            proxy_read_timeout      150s;
            proxy_next_upstream error timeout invalid_header http_404 http_500 http_502 http_504;
        }
    }
    

      

    启动nginx

    /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    

      

  • 相关阅读:
    日期获取以及时间转化
    ddt 接口框架数据处理调用excel 处理
    ddt 测试用例UI运用
    动态验证码处理UI自动化获取处理
    Bug Report For .Net (zz.IS2120@BG57IV3)
    中关村翠湖科技园:高端产业聚集区 (zz.IS2120@BG57IV3.T752270541 .K)
    vc6,windows 7 x64 调试 (IS2120@BG57IV3)
    Excel c#Excel文件的操作[转载]
    NUnit学习 标签、方法 记录与说明
    Excel c#Excel工作进程的创建写 与Excel文件的保存[原创] (20100205 11:09)
  • 原文地址:https://www.cnblogs.com/cjsblogs/p/8426140.html
Copyright © 2020-2023  润新知