#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. yaml中使用harbor

    1.在harbor的ui界面上注册一个账号 姓名:zihao 全名:zhuzihao 密码:Zihao@5tgb 邮箱:15613691030@163.com 2.在需要下载镜像的机器上,同样需要修改 ...

  2. centos7下使用yum安装mysql5.7.10

    原文地址:http://www.mamicode.com/info-detail-503994.html CentOS7的yum源中默认好像是没有mysql的.为了解决这个问题,我们要先下载mysql ...

  3. beego框架(golang)学习验证码

    beego框架(golang)学习验证码 登录页面使用验证码 路由设置 /beego_admin_template/routers/router.go get请求页面, post验证用户名密码和验证码 ...

  4. 爬虫存储介质之CSV文件存储

    本文章来自度娘 CSV文件存储 CSV,全称为Comma-Separated Values,中文可以叫做逗号分隔值或字符分隔值,其文件以纯文本形式 存储表格数据.该文件是一个字符序列,可以由任意数目的 ...

  5. 1. Arduino对第三方开发板的支持

    Arduino对第三方开发板也有支持接口,需要手动添加,我们以STM32系列为例,说明添加过程. 目前st的官方提供的一系列板子都支持Arduino,可能是Arduino-IDE更新太慢,目前版本没有 ...

  6. rdkafka swoole

    1.yum install php-devel php-pear 2. wget http://pear.php.net/go-pear.phar 3.PHP go-pear.phar 4.cp /r ...

  7. 用jquery和php实现ajax异步请求响应

    ajax技术可以实现异步请求和响应,下面的是用jquery向一个php脚本发送异步请求,并得到响应. 第一步,准备好前台的html表单,和jquery实现的ajax请求 <html lang=& ...

  8. 09 IO流(六)——ByteArray字节流、流对接

    字节数组流 ByteArray流是节点流. 前面讲到的文件字节流,文件字符流,他们的源都是来自于pc硬盘. 本节要讲的字节数组流的源是来自于内存或网络. 它更合适用来处理来自网络的字节流. 由于源并不 ...

  9. PAT(B) 1069 微博转发抽奖(Java)

    题目链接:1069 微博转发抽奖 (20 point(s)) 题目描述 小明 PAT 考了满分,高兴之余决定发起微博转发抽奖活动,从转发的网友中按顺序每隔 N 个人就发出一个红包.请你编写程序帮助他确 ...

  10. Linux查询命令帮助信息(知道)

    方法一 command --help 方法二 man command 操作涉及到的按键: 空格键:显示手册的下一屏 Enter键:一次滚动手册的一行 b:回滚一屏 f:前滚一屏 q:退出 结果基本上全 ...