第十六篇 nginx主配置文件参数解释
# 指定拥有运行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主配置文件参数解释的更多相关文章
- Nginx 主配置文件参数详解
Nginx 主配置文件参数详解 Nginx 安装完毕后,会有响应的安装目录,安装目录里 nginx.conf 为 nginx 的主配置文件, ginx 主配置文件分为 4 部分,main(全局配置). ...
- Python之路【第十六篇】:Django【基础篇】
Python之路[第十六篇]:Django[基础篇] Python的WEB框架有Django.Tornado.Flask 等多种,Django相较与其他WEB框架其优势为:大而全,框架本身集成了O ...
- Nginx主配置参数详解,Nginx配置网站
1.Niginx主配置文件参数详解 a.上面博客说了在Linux中安装nginx.博文地址为:http://www.cnblogs.com/hanyinglong/p/5102141.html b.当 ...
- Centos7 nginx的目录结构与nginx主配置文件解析
一.nginx的目录结构 [root@node nginx_116]# ls client_body_temp conf fastcgi_temp html logs proxy_temp ...
- 解剖SQLSERVER 第十六篇 OrcaMDF RawDatabase --MDF文件的瑞士军刀(译)
解剖SQLSERVER 第十六篇 OrcaMDF RawDatabase --MDF文件的瑞士军刀(译) http://improve.dk/orcamdf-rawdatabase-a-swiss-a ...
- 跟我学SpringCloud | 第十六篇:微服务利剑之APM平台(二)Pinpoint
目录 SpringCloud系列教程 | 第十六篇:微服务利剑之APM平台(二)Pinpoint 1. Pinpoint概述 2. Pinpoint主要特性 3. Pinpoint优势 4. Pinp ...
- Egret入门学习日记 --- 第十六篇(书中 6.10~7.3节 内容)
第十六篇(书中 6.10~7.3节 内容) 昨天搞定了6.9节,今天就从6.10节开始. 其实这个蛮简单的. 这是程序员模式. 这是设计师模式. 至此,6.10节 完毕. 开始 6.11节. 有点没营 ...
- my.cnf 配置文件参数解释
my.cnf 配置文件参数解释: #*** client options 相关选项 ***# #以下选项会被MySQL客户端应用读取.注意只有MySQL附带的客户端应用程序保证可以读取这段内容.如果你 ...
- nginx主配置文件学习,以及nginx的反向代理和负载均衡
1.nginx.conf主配置文件学习 worker_processes : 表示nginx的进程数,根据CPU的核数来定义,起到优化的作用.通过cat /proc/cpuinfo来查看核数 even ...
随机推荐
- 文件分配表(FAT)及其结构
原链接:https://blog.csdn.net/qianjintianguo/article/details/712590?utm_source=blogxgwz6 文件分配表(FAT)是文件管理 ...
- MongoDB批量更新和批量插入的方式
最近,在调试代码中发现向MongoDB插入或者更新文档记录时若是多条的话都是采用for循环操作的,这样的处理方式会造成数据操作耗时,不符合批量处理的原则:对此,个人整理了一下有关MongoDB的批量更 ...
- SendMessage模拟按键所需的虚拟键码
Virtual-Key Codes The following table shows the symbolic constant names, hexadecimal values, and mou ...
- Windows里面的虚拟机,部署的项目在同一网段也可以访问到
一直想对自己Linux里面部署的项目进行再同一网段进行共享让其他和我同网段的人都看到 今天对于这个问题我终于解决了 首先编辑自己的虚拟机 进行虚拟机网络编辑 选择VMnet8 然后进行下面的NET设置 ...
- vue animate.css训练动画案例 列表循环
制作目标动画:向上入场添加数据,点击数据右滑动离场 简单页面效果: 实现代码如下: <!DOCTYPE html> <html> <head> <meta c ...
- Alice and Hairdresser
Alice's hair is growing by leaps and bounds. Maybe the cause of it is the excess of vitamins, or may ...
- C++——多态性
多态是指发出同样的消息被不同类型的对象接收时有可能导致完全不同的行为: 多态的实现:函数重载:运算符重载:虚函数 为什么需要重载运算符? 在C++没有复数运算,进行复数运算之前我们要事先写一个复数类, ...
- ES源码阅读过程
HTTP请求的controller:RestController 游标的作用 相当于建立了一个 limit的priorityqueue 不用游标的话,相当于建立一个limit+offset的prior ...
- Oracle 11g安装 —— Oracle Database 11g Release2 for Windows(x64)
文章来自:https://blog.csdn.net/IT_xiao_guang_guang/article/details/104422421 下面是我的Oracle 11g安装过程,希望可以帮到正 ...
- 函数match应打印s中从ch1到ch2之间的所有字符,并且返回ch1的地址。
1 char *match( char *s, char ch1, char ch2 ){ ; ; ; while(s[len]){ len++; } *len+];//防止s字符串全满导致t溢出 * ...