#user  nobody;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} 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"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; server {
listen 80;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root html;
index index.html index.htm;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
   }
}

上面是nginx的默认配置文件,现在把它肢解

第一部分

#user  nobody;        #启动用户,指定启动nginx进程的用户。
worker_processes 1;        #worker进程数,nginx由master和worker进程组成。属上下级关系,ps -ef|grep nginx可见其进程 #error_log logs/error.log;      #错误日志记录等级,由低到高,最低只记录致命错误。
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid;        #nginx进程pid,默认在logs/nginx.pid记录,通过kill -USR2可更新pid文件,原文件被重命名为nginx.pid.oldbin

第二部分

events {  #内核的参数
      worker_connections 1024;      #控制worker进程的线程数 

}

第三部分

http { #网站配置参数,可以嵌套多个server,配置代理,缓存,日志定义等绝大多数功能和第三方模块的配置
include mime.types;    #默认支持的文件类型,使用include包含,mime.type文件在conf/下
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"'; #access_log logs/access.log main;    #默认日志记录位置及文件名 sendfile on;  #默认激活sendfile系统调用来传输文件,以实现零拷贝(完全在内核中操作)
#tcp_nopush on;  #默认激活tcp_nopush参数可以把httpresponse header和文件的开始放在一个文件里发布,以减少网络报文段的数量 #keepalive_timeout 0;  #连接超时时间,秒
keepalive_timeout 65; #gzip on;  #默认开启gzip压缩功能 server {  #被包含在http段中,用来配置虚拟主机,每一个server段代表一个虚拟主机
listen 80;  #当前server监听端口
server_name localhost;  #当前server域名 #charset koi8-r;  #默认使用koi8-r编码 #access_log logs/host.access.log main;  当前server日志生成位置及文件名 location / {  #被包含在server段中,用来匹配域名请求和调用第三方模块
root html;  #访问的web网页位置
index index.html index.htm;  #指定首页
} #error_page 404 /404.html;  #配置错误代码404跳转页面 # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;  #配置错误代码50x跳转页面
location = /50x.html {
root html;
}
}
}

Nginx.conf配置文件默认配置块略解的更多相关文章

  1. Nginx入门讲解——初步认识了解nginx.conf配置文件以及配置多个虚拟主机

    本文引自网络进攻学习之用https://blog.csdn.net/weixin_38111957/article/details/81080539 一. 引言上节文章讲述了如何用信号控制Nginx服 ...

  2. nginx配置tomcat负载均衡,nginx.conf配置文件的配置

  3. nginx详解(代理服务器的解释+nginx 在linux 下的安装+nginx.conf 中的配置解释)

    一.概论 1.什么是代理服务器 代理服务器,客户机在发送请求时,不会直接发送给目的主机,而是先发送给代理服务器,代理服务接受客户机请求之后,再向主机发出,并接收目的主机返回的数据,存放在代理服务器的硬 ...

  4. Nginx(二)------nginx.conf 配置文件

    上一篇博客我们将 nginx 安装在 /usr/local/nginx 目录下,其默认的配置文件都放在这个目录的 conf 目录下,而主配置文件 nginx.conf 也在其中,后续对 nginx 的 ...

  5. nginx介绍(二) - 默认配置

    前言 前面, 在浏览器中, 输入linux 的ip, 出现了以下页面: 那这个页面在哪里呢? 一. 工具 notepad++ 在进入主题之前, 先来介绍下, 一会使用到的工具. 在notepad++里 ...

  6. [原]生产环境下的nginx.conf配置文件(多虚拟主机)

    [原]生产环境下的nginx.conf配置文件(多虚拟主机) 2013-12-27阅读110 评论0 我的生产环境下的nginx.conf配置文件,做了虚拟主机设置的,大家可以根据需求更改,下载即可在 ...

  7. Redis:redis.conf配置文件 - 及配置详解

    配置文件详解(文章最后有完整的redis.conf文件) ###################################  NETWORK  ######################### ...

  8. 01_Nginx安装,nginx下部署项目,nginx.conf配置文件修改,相关文件配置

     1.下载Nginx,进入Nginx下载地址:http://nginx.org/ 点击nginx-1.8.0,进入:http://nginx.org/en/download.html,下载文件: ...

  9. /etc/nginx/nginx.conf配置文件详解

    user nginx; #数值和cpu核数个数一致worker_processes 8; #worker与cpu绑定 worker_cpu_affinity 0001 0010 0100 1000 1 ...

随机推荐

  1. 把总数amount拆分以标准差最小的标准,平均拆分成count个整数

    public function tt_add(){ $res = $,); echo array_sum($res); echo '----' . count($res); dump($res); e ...

  2. Swift4.0复习基本语法简介

    1.五种类型: 包含五种类型——枚举(enum).结构体(struct).类(class).协议( protocol)以及函数类型(function types). 2.变量对象:var 3.常量对象 ...

  3. 【Leetcode_easy】977. Squares of a Sorted Array

    problem 977. Squares of a Sorted Array solution: class Solution { public: vector<int> sortedSq ...

  4. 【机器学习】attention机制

    参考: 1.https://lilianweng.github.io/lil-log/2018/06/24/attention-attention.html

  5. 热修复干货| AndFix热补丁动态修复框架使用教程

    本篇文章会与大家一起学习使用阿里的AndFix热修复框架,可以说AndFix是国内热修复技术的开山始祖,尽管现在阿里已经放弃了对这个项目的维护,但是后来很多的热修复技术都借鉴了这一框架的实现思路. 1 ...

  6. 《C语言程序设计》课程教学目录

    <C语言程序设计>课程教学目录 不要去精确定义单个论题,应将一整套问题组织成体系.--黎曼(1826-1866)德国著名数学家 教学过程 2018年秋季学期 C语言程序设计I-第一周教学 ...

  7. java的ReentrantLock类详解

    ReentrantLock 能用于更精细化的加锁的Java类, 通过它能更清楚了解Java的锁机制 ReentrantLock 类的集成关系有点复杂, 既有内部类, 还有多重继承关系 类的定义 pub ...

  8. [SQL SERVER] - 数据表 保存 / 查看 海量文本的方法

    背景 WCF + EF + Sql Server 提供服务,包含一个数据上传功能,该方法接收客户端上传的对象列表(多张表单,每个表单包含千余条相关记录). 瓶颈 WCF 默认有文件大小(4M)和超时限 ...

  9. [PDF] - 获取 RadioButtonList 控件值的方法

    背景 目标是通过 iTextSharp 读取 PDF 模板,填充内容后以生成新 PDF 文件.利用 福昕PDF编辑器个人版 可以获取到 RadioButtonList 的组名,但是获取不到每一个 Ra ...

  10. 二进制知识(java中的位操作)

    文章目录 前言 机器数 真值 原码 反码 补码 计算机中保存的都是补码 位操作 强制转换,精度丢失 前言 讲二进制的东西,必须要说明是多少位机器,八位机上的 1000 1000 和 十六位机上的 10 ...