zoukankan      html  css  js  c++  java
  • 配置-定制每一台Nginx服务的响应头,以便于当某台服务出现问题时能快速定位到具体的服务器

    1.定制每一台Nginx服务的响应头,以便于当某台服务出现问题时能快速定位到具体的服务器

    # cat nginx.conf.j2
    user              nginx;
    {# start process equal cpu cores #}
    worker_processes {{ ansible_processor_vcpus }};
    
    error_log  /var/log/nginx/error.log;
    pid        /var/run/nginx.pid;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include       /etc/nginx/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"';
    
        sendfile        on;
        tcp_nopush     on;
    
        keepalive_timeout  0;
    
        gzip on;
        gzip_min_length  1k;
        gzip_buffers     8 64k;
        gzip_http_version 1.0;
        gzip_comp_level 5;
        gzip_types   text/plain application/x-javascript text/css application/json application/xml application/x-shockwave-flash application/javascript image/svg+xml image/x-icon;
        gzip_vary on;
        {# add_header {{ ansible_hostname }}; #}
        add_header x-hostname {{ ansible_hostname  }};
    
        include /etc/nginx/conf.d/*.conf;
    }

    https://www.jianshu.com/p/2350ef38a06e

     

    用一个例子来演示会更加清晰
  • 相关阅读:
    分页bootstrap
    导航条bootstrap
    导航bootstrap
    栅格系统bootstrap
    「ICPC2015 WF」Pipe Stream
    「LOJ#3399」Communication Network
    「WC2019」数树
    「UTR #3」量子破碎
    XJOI1105模拟赛 积木游戏
    XJOI1104NOIP模拟赛
  • 原文地址:https://www.cnblogs.com/hixiaowei/p/13876094.html
Copyright © 2011-2022 走看看