# 指定拥有运行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. 【Python可视化】超详细Pyecharts 1.x教程,让你的图表动起来~

    前言 pyecharts 是一个用于生成 Echarts 图表的Python库.Echarts是百度开源的一个数据可视化 JS 库,可以生成一些非常酷炫的图表. Pyecharts在1.x版本之后迎来 ...

  2. mysql 视图 触发器 存储过程 函数事务 索引

    mysql 视图 触发器 存储过程 函数事务 索引 视图 视图是一个虚拟表(非真实存在),其本质是[根据SQL语句获取动态的数据集,并为其命名],用户使用时只需使用[名称]即可获取结果集,并可以将其当 ...

  3. Pi和e的积分

    Evaluate integral $$\int_{0}^{1}{x^{-x}(1-x)^{x-1}\sin{\pi x}dx}$$ Well,I think we have $$\int_{0}^{ ...

  4. Wannafly Camp 2020 Day 6M 自闭 - 模拟

    按题意模拟,又乱又烦,没什么可说的 #include <bits/stdc++.h> using namespace std; #define int long long int n,m, ...

  5. 如何在macOS下安装geoserver

    macOS 下的编译包 如果是使用安装文件,请查看官网文档,如果想要部署在已有的tomcat服务下,请查看网页压缩包章节. Web archive. An alternate way of insta ...

  6. 解决SourceTree每次拉取提交都需要输入密码的问题

    打开终端并且输入: git config --global credential.helper osxkeychain 第一次需要输入密码,以后都不需要了

  7. jarvis OJ部分writeup

    [XMAN]level 0 [XMAN]level 1 —— 简单shellcode利用 [XMAN]level 2 [XMAN]level 3 —— ret2libc尝试 [XMAN]level2& ...

  8. python调用HEG工具批量处理MODIS数据

    下面的代码主要用于使用python语言调用NASA官方的MODIS处理工具HEG进行投影坐标转换与重采样批量处理 主要参考 HEG的用户手册:https://newsroom.gsfc.nasa.go ...

  9. HTML表格显示的笔记

    有时需要显示的复杂表头 如图所示  <table id="" cellpadding="0" cellspacing="0" bord ...

  10. 油候插件grant的使用

    // ==UserScript== // @name Test Baidu // @namespace http://www.baidu.com/ // @version 0.1 // @descri ...