• 【个人笔记】跟着官方文档学nginx——Basic Functionality基础功能


    有点尴尬,官方文档看错地方了,真正的官方文档在https://docs.nginx.com/nginx/admin-guide/basic-functionality/runtime-control/

    基础功能分为两部分

    Controlling NGINX Processes at Runtime——移步https://www.cnblogs.com/haon/p/10962160.html

    Creating NGINX Plus and NGINX Configuration Files——移步https://www.cnblogs.com/haon/p/10961838.html

    本文将对nginx.conf 更细致的讲解

    开始

    nginx.conf 分为三个部分

    Directives指令

    普通指令如:

    user             nobody;
    error_log        logs/error.log notice;
    worker_processes 1;

    Feature-Specific Configuration Files 特殊配置文件

    推荐分割,保存在/etc/nginx/conf.d下,用include加载内容

    ex:

    include conf.d/http;
    include conf.d/stream;
    include conf.d/exchange-enhanced;

    这里我看不懂,保存的啥,include取的啥

    Contexts 内容主体

    根据通信种类不同分为

    针对一种通信方式可以有多个server指令块(虚拟服务器),通信方式决定server内的可用指令

    user nobody; # a directive in the 'main' context
    
    events {
        # configuration of connection processing
    }
    
    http {
        # Configuration specific to HTTP and affecting all virtual servers  
    
        server {
            # configuration of HTTP virtual server 1       
            location /one {
                # configuration for processing URIs starting with '/one'
            }
            location /two {
                # configuration for processing URIs starting with '/two'
            }
        } 
        
        server {
            # configuration of HTTP virtual server 2
        }
    }
    
    stream {
        # Configuration specific to TCP/UDP and affecting all virtual servers
        server {
            # configuration of TCP virtual server 1 
        }
    }

    这里还讲了嵌套context的情况,没看懂,先保留

    Inheritance

    In general, a child context – one contained within another context (its parent) – inherits the settings of directives included at the parent level. Some directives can appear in multiple contexts, in which case you can override the setting inherited from the parent by including the directive in the child context. For an example, see the proxy_set_header directive.

  • 相关阅读:
    java的基本数据类型有八种:
    BZOJ 1003 [ZJOI2006]物流运输trans
    BZOJ 1002 [FJOI2007]轮状病毒
    BZOJ 1001 [BeiJing2006]狼抓兔子
    FFT修正
    主席树修正
    COJ 0995 WZJ的数据结构(负五)区间操作
    COJ 1010 WZJ的数据结构(十) 线段树区间操作
    COJ 0999 WZJ的数据结构(负一)
    AC自动机修正
  • 原文地址:https://www.cnblogs.com/haon/p/10962329.html
Copyright © 2020-2023  润新知