1、nginx配置文件的结构-阅读官方文档

官网链接:Beginner’s Guide

翻译部分:Configuration File’s Structure

# nginx consists of modules which are controlled by directives specified in the configuration file.

nginx由模块构成,这些模块由指令控制,指令定义在nginx配置文件中

# Directives are divided into simple directives and block directives.

指令划分为简单指令和块指令

# A simple directive consists of the name and parameters separated by spaces and ends with a semicolon (;).

简单指令由名称和参数构成,名称和参数用空格分隔开,指令以;结束,如:

proxy_pass http://www.baidu.com;

# A block directive has the same structure as a simple directive, but instead of the semicolon it ends with a set of additional instructions surrounded by braces ({ and }). 

块指令有着和简单指令一样的结构,不同的是,块指令不以;结束,它被一对括弧{}包围

# If a block directive can have other directives inside braces, it is called a context (examples: eventshttpserver, and location).

如果块指令{}里面有其他指令(例如:events,http,server,location),那么它叫做context

# Directives placed in the configuration file outside of any contexts are considered to be in the main context.

在配置文件中但不在任何context(即{})里面的指令被认为是在main context

# The events and http directives reside in the main context, server in http, and location in server.

人话:

events {}  #events指令在main context里

http {   #http指令在main context里

        server {   #server指令在http context里

                location    #location指令在server context里

        }

}

# The rest of a line after the # sign is considered a comment.

一行中在#后面的部分是注释 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值