第十六篇 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 ...
随机推荐
- 树莓派中安装ubuntu及相关设置
一.下载并烧录系统 首先准备好我们要烧录的ubuntu_meta系统,可以在树莓派官网中下载https://www.raspberrypi.org/downloads/ 这里我们选择 Raspberr ...
- MySQL8.0.11解压版安装详细教程
1. 从官网下载zip包 官网网址(https://dev.mysql.com/downloads/mysql/) 2. 解压 将压缩包解压到一个目录(后续将此目录作为安装目录),我这里是解压到了D: ...
- AntDesign(React)学习-4 登录页面提交数据简单实现
github代码:https://github.com/zhaogaojian/jgdemo 全国肺炎,过节期间没地方去在家学习antd. 一.感觉antd pro项目太庞大了,可以学习下结构和代码风 ...
- 执行python程序的方式
1.交互器 程序不能永久保存 主要用于简单的语法测试相关 2.文件执行
- Centos7安装python3.6.5
安装python3.6.5,原来的python2.7.5并存 准备环境: 登录你的linux虚拟机或者云服务器,进入命令行界面如下图: 进入这样的窗口就是远程登录成功,我这里使用的是远程连接工具xsh ...
- SUSE中搭建kafka
搭建环境: JDK: java version 1.8.0_221 zookeeper:zookeeper-3.5.2 kafka: kafka-2.11-1.1.0 一.安装JDK 由于需要jav ...
- 关于微信小程序
1.设置了tabBar的页面,好像用navigator跳不过去.
- c#数据筛选和排序
一.TreeView SelectedNode 选中的节点 Level 节点的深度(从0开始) AfterSelect 节点选中后 ...
- Django教程(1)
增加新的视图: 1. 在app/view.py下增加调用视图函数 def horizonG(request): return render(request, 'horizonG.html') 2. 在 ...
- 从原理到方案,一步步讲解web移动端实现自适应等比缩放
前言 在移动端做自适应,我们常用的有媒体查询,rem ,em,宽度百分比这几种方案.但是都各有其缺点. 首先拿媒体查询来说,在某一个宽度区间内只能使用一种样式,为了适应不同屏幕要,css的代码量就会增 ...