Nginx.conf配置文件默认配置块略解
#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配置文件默认配置块略解的更多相关文章
- Nginx入门讲解——初步认识了解nginx.conf配置文件以及配置多个虚拟主机
本文引自网络进攻学习之用https://blog.csdn.net/weixin_38111957/article/details/81080539 一. 引言上节文章讲述了如何用信号控制Nginx服 ...
- nginx配置tomcat负载均衡,nginx.conf配置文件的配置
- nginx详解(代理服务器的解释+nginx 在linux 下的安装+nginx.conf 中的配置解释)
一.概论 1.什么是代理服务器 代理服务器,客户机在发送请求时,不会直接发送给目的主机,而是先发送给代理服务器,代理服务接受客户机请求之后,再向主机发出,并接收目的主机返回的数据,存放在代理服务器的硬 ...
- Nginx(二)------nginx.conf 配置文件
上一篇博客我们将 nginx 安装在 /usr/local/nginx 目录下,其默认的配置文件都放在这个目录的 conf 目录下,而主配置文件 nginx.conf 也在其中,后续对 nginx 的 ...
- nginx介绍(二) - 默认配置
前言 前面, 在浏览器中, 输入linux 的ip, 出现了以下页面: 那这个页面在哪里呢? 一. 工具 notepad++ 在进入主题之前, 先来介绍下, 一会使用到的工具. 在notepad++里 ...
- [原]生产环境下的nginx.conf配置文件(多虚拟主机)
[原]生产环境下的nginx.conf配置文件(多虚拟主机) 2013-12-27阅读110 评论0 我的生产环境下的nginx.conf配置文件,做了虚拟主机设置的,大家可以根据需求更改,下载即可在 ...
- Redis:redis.conf配置文件 - 及配置详解
配置文件详解(文章最后有完整的redis.conf文件) ################################### NETWORK ######################### ...
- 01_Nginx安装,nginx下部署项目,nginx.conf配置文件修改,相关文件配置
1.下载Nginx,进入Nginx下载地址:http://nginx.org/ 点击nginx-1.8.0,进入:http://nginx.org/en/download.html,下载文件: ...
- /etc/nginx/nginx.conf配置文件详解
user nginx; #数值和cpu核数个数一致worker_processes 8; #worker与cpu绑定 worker_cpu_affinity 0001 0010 0100 1000 1 ...
随机推荐
- 0010.Regular Expression Matching(H)
jjc . Regular Expression Matching(hard) Given an input string (s) and a pattern (p), implement regul ...
- Swift 4.0 Xib实现Button调整
1.Xib画的界面按钮,代码中进行调整按钮图片在上,文字在下: 代码中修改按钮的位置比较好: payButton.titleEdgeInsets = UIEdgeInsetsMake((payButt ...
- idea里面lombok要如何设置后才会生效
16:31 Lombok Requires Annotation Processing Annotation processing seems to be disabled for the proje ...
- [转]Xmind 8 pro 软件破解版
链接地址:https://blog.csdn.net/qq_16093323/article/details/80967867 作者博客:http://www.carrotchou.blog/
- CSS3动画框架 Animate.css
CSS3的动画应用越来越多了,Animate.css一个从名字上就知道干什么的动画框架. github上的访问地址:http://daneden.github.io/animate.css/ 使用方法 ...
- CentOS7为docker-ce配置阿里云镜像加速器
一.找加速地址 https://promotion.aliyun.com/ntms/act/kubernetes.html 控制台 二.添加daemon.json 文件 vim /etc/docker ...
- 找出整数数组中出现次数超过数组长度一半的元素(Java)
Question:数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字 package com.study.zhipengs.test; import java.util.Arrays; im ...
- mysql 库、表、数据的增删改
数据库定义 语法形式 (1)创建数据库 create database [if not exists ] 数据库名 [charset 字符集] [collate 字符排序规则]; if not exi ...
- spring添加事物
<context:component-scan base-package="com.zlkj" > <context:include-filter type=&q ...
- Python3数据类型之数字
1. Python数字类型的作用 Python数字类型用来存储数值,它是不可变对象,一旦定义之后,其值不可以被修改.如果改变了数字类型的值,就要重新为其分配内存空间. 定义一个数字类型的变量:a = ...