# 指定拥有运行nginx权限的用户
#user nobody; # 指定开启的进程数,建议设置为CPU核心数
worker_processes ; # 指定全局错误日志级别,包括:debug/info/notice/warn/error/crit
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; # 指定nginx的主进程id的存储位置
pid logs/nginx.pid; # 一个nginx进程最多能打开的文件描述符数目,理论上应该等于系统最多能打开的文件数与nginx进程数相除
worker_rlimit_nofile ; events { # 指定工作模式
# epoll使Linux2.6以上版本的高性能网络I/O模型
# 如果跑在FreeBSD上面,使用kqueue模型
use epoll; # 指定每个进程的最大连接数,受系统进程的最大打开文件数量限制
worker_connections ;
} # 配置http服务器
http {
# include是进行配置导入的指令
# 导入文件扩展名与文件类型映射表
include mime.types; # 导入所有站点的配置文件(开启此命令可以实现为每个站点单独建一个配置文件,以实现隔离)
include servers/*.conf; # 指定默认文件类型,这里设置为二进制流
default_type application/octet-stream; # 指定默认编码
#charset utf-; # 指定服务器名字的hash表大小
#server_name_hash_bucket_size ; # 指定允许客户端请求的最大单个文件字节数
#client_max_body_size 20M; # 指定客户端请求头的headerbuffer大小
#client_header_buffer_size 32k; # 指定客户端请求试图写入缓存文件的目录路径
#client_body_temp_path /dev/shm/client_body_temp; # 指定客户端请求中较大的消息头的缓存最大数量和大小
#large client_header_buffers 32k; #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;
# 开启防止网络阻塞
tcp_nodely on; # 指定连接超时时间,单位是秒
#keepalive_timeout ;
keepalive_timeout ;
# 指定读取请求header超时时间
#client_header_timeout ;
# 指定读取请求body超时时间
#client_body_timeout ; # http的gzip模块配置 # 开启gzip压缩
#gzip on; # 指定最小压缩文件大小
#gzip_min_length 1k; # 申请4个大小为16k的内存空间作为压缩缓冲区
#gzip_buffers 16k; # 设置识别http协议的版本,默认为1.
#gzip_http_version 1.1 # 指定gzip压缩比,-,数字越小压缩比越小,压缩速度越快
#gzip_comp_level ; # 指定压缩类型
# 默认已包含text/html,如果再次指定,会有一个warn
#gzip_type text/plain application/x-javascript text/css application/xml; #gzip_vary on; # upstream用于实现负载均衡
# weight表示权重,值越大分配到的几率越大
upstream fisher {
server 127.0.0.1: weight=;
server 127.0.0.1: weight=;
server 127.0.0.1: weight=;
} # 配置代理缓存
# levels用来指定可以生成二级目录,否则所有缓存都会放在一起
# keys_zone设置用来查找缓存的键的存储空间的大小
# fisher是server对应的缓存的目录名,在每个server的location中定义
proxy_cache_path /var/nginx/cache levels=1:2 keys_zone=fisher:20m;
# 虚拟主机配置
server { # 指定监听端口
listen ; # 指定域名,若有多个,用空格隔开(就是在浏览器中输入的域名)
server_name localhost; # 指定编码
#charset koi8-r; # 指定虚拟主机访问日志的存放路径,日志格式为main
#access_log logs/host.access.log main; # 配置虚拟主机的基本信息
location / {
# 设置虚拟主机的网站根目录
root html;
# 设置虚拟主机默认访问的网页
index index.html index.htm;
# 设置缓存目录名
proxy_cache fisher;
proxy_pass http://fisher;
# 设置代理头信息,获取到浏览器请求的host信息
proxy_set_header Host $host;
} #error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen ;
# listen somename:;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }

第十六篇 nginx主配置文件参数解释的更多相关文章

  1. Nginx 主配置文件参数详解

    Nginx 主配置文件参数详解 Nginx 安装完毕后,会有响应的安装目录,安装目录里 nginx.conf 为 nginx 的主配置文件, ginx 主配置文件分为 4 部分,main(全局配置). ...

  2. Python之路【第十六篇】:Django【基础篇】

    Python之路[第十六篇]:Django[基础篇]   Python的WEB框架有Django.Tornado.Flask 等多种,Django相较与其他WEB框架其优势为:大而全,框架本身集成了O ...

  3. Nginx主配置参数详解,Nginx配置网站

    1.Niginx主配置文件参数详解 a.上面博客说了在Linux中安装nginx.博文地址为:http://www.cnblogs.com/hanyinglong/p/5102141.html b.当 ...

  4. Centos7 nginx的目录结构与nginx主配置文件解析

    一.nginx的目录结构 [root@node nginx_116]# ls client_body_temp  conf  fastcgi_temp  html  logs  proxy_temp ...

  5. 解剖SQLSERVER 第十六篇 OrcaMDF RawDatabase --MDF文件的瑞士军刀(译)

    解剖SQLSERVER 第十六篇 OrcaMDF RawDatabase --MDF文件的瑞士军刀(译) http://improve.dk/orcamdf-rawdatabase-a-swiss-a ...

  6. 跟我学SpringCloud | 第十六篇:微服务利剑之APM平台(二)Pinpoint

    目录 SpringCloud系列教程 | 第十六篇:微服务利剑之APM平台(二)Pinpoint 1. Pinpoint概述 2. Pinpoint主要特性 3. Pinpoint优势 4. Pinp ...

  7. Egret入门学习日记 --- 第十六篇(书中 6.10~7.3节 内容)

    第十六篇(书中 6.10~7.3节 内容) 昨天搞定了6.9节,今天就从6.10节开始. 其实这个蛮简单的. 这是程序员模式. 这是设计师模式. 至此,6.10节 完毕. 开始 6.11节. 有点没营 ...

  8. my.cnf 配置文件参数解释

    my.cnf 配置文件参数解释: #*** client options 相关选项 ***# #以下选项会被MySQL客户端应用读取.注意只有MySQL附带的客户端应用程序保证可以读取这段内容.如果你 ...

  9. nginx主配置文件学习,以及nginx的反向代理和负载均衡

    1.nginx.conf主配置文件学习 worker_processes : 表示nginx的进程数,根据CPU的核数来定义,起到优化的作用.通过cat /proc/cpuinfo来查看核数 even ...

随机推荐

  1. 使用nohup不产生log文件方法

    思想 无法阻止nohup产生日志可以将其定向到空文件实现 实现 $ nohup xxx >/dev/null 2>&1 &

  2. 为什么SSL证书要设有效期?

    1.首先是为了安全考虑,CA机构不能保证一个网站永远是合法的,因此它需要定期检查网站. 2.其次,以往CA证书都非常贵,签发证书的机构通过设置期限来收费,是一种商业途径. 3.最后,还有最重要的原因就 ...

  3. Leetcode Week4 Find Minimum in Rotated Sorted Array II

    Question Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforeha ...

  4. java中类的构造方法出错点

    大家请看下面的这个代码 package ppt_test; public class test1 { public static void main(String args[]) { Foo obj1 ...

  5. [CF1304F] Animal Observation - dp,单调队列

    设 \(f[i][j]\) 为第 \(i\) 天在第 \(j\) 个位置放置的最大值,设 \(s[i][j]\) 是第 \(i\) 行的前缀和,则 \[ \begin{align} f[i][j] & ...

  6. 在macOS 上添加 JAVA_HOME 环境变量

    If you are planing to develop Java Apps on your Mac, you may have to set $JAVA_HOME environment vari ...

  7. 项目转移时发生的错误<springboot+mybatis(xml逆向工程自动生成)>

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'app ...

  8. c++中vector函数

    std::vector <cv::Point> VectorPoints 说明:首先定义一个Point(即Point2i---二维整型的点)类型的变量VectorPoints,这就是我们创 ...

  9. Gin_入门

    1. 创建路由 1.1 Restful风格的API gin支持Restful风格的API 即Representational State Transfer的缩写.直接翻译的意思是"表现层状态 ...

  10. C#中向ListView控件中添加一行数据

    C#中向ListView控件中添加一行数据: ,先声明一个ListViewItem: ListViewItem item = new ListViewItem(); ,添加第一列数据: item.Te ...