nginx 配置文件解析(一)
nginx.conf
user nginx;
# nginx服务的运行用户
worker_processes ;
# 启动进程数,通常设置成和CPU的数量相等 error_log /var/log/nginx/error.log;
# 错误日志,错误级别
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid;
# pid文件路径 events {
worker_connections ;
}
# 工作模式及连接数上限
详情见 events详解 http {
# 设定http服务器, 详情见http详解
include /etc/nginx/mime.types;
# 设定 mime类型,类型由mime.type文件定义
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 /var/log/nginx/access.log main;
# 访问日志,级别
sendfile on;
# sendfile 指令指定了nginx 是否调用 sendfile函数(zero copy 方式) 来输出文件,
# 对于普通应用,必须设置为on,如果用来进行下载等应用磁盘IO重负载应用,可设置为off,以平衡磁盘与网络I/O处理速度,降低系统的uptime
#tcp_nopush on; #keepalive_timeout ;
keepalive_timeout ;
# 超时时间
#gzip on;
# 启用压缩
# Load config files from the /etc/nginx/conf.d directory
# The default server is in conf.d/default.conf
include /etc/nginx/conf.d/*.conf;
# 调用其它位置配置文件.
}
default.conf
server {
# 服务配置项,具体查询server详解
listen default_server;
# 监听端口
server_name _;
# 服务名字.
#charset koi8-r;
# 字符集
#access_log logs/host.access.log main;
# 服务自定义的访问日志
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
# 导入其他位置的配置文件
location / {
# 根配置
root /usr/share/nginx/html;
# 根目录的位置
index index.html index.htm;
# 首页直接打开的文件名称从左到右依次搜索
}
error_page 404 /404.html;
# 定义错误提示页面
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
# php 文件的配置,fastcgi配置
root html;
fastcgi_pass 127.0.0.1:9000;
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;
#}
}
nginx 配置文件解析(一)的更多相关文章
- nginx配置文件解析工具
最近花了一些时间自己实现解析nginx配置文件的功能,这里有个工具先记下以后用. https://github.com/nginxinc/crossplane
- Nginx配置文件解析
user nginx nginx; #定义Nginx运行的用户和用户组 worker_processes 1; #nginx进程数,建议设置为等于CPU总核心数 worker_rlimit_nofil ...
- Nginx 配置文件解析
nginx 整理 nginx 配置主要是分为4个部分 1.main 全局设置2.server 主机设置 -- 指定主机与端口3.upstream 负载均衡服务器设置 -- 反向代理设置:4.locat ...
- Nginx安装部署以及配置文件解析
Nginx 中的 Location 指令 是NginxHttpCoreModule中重要指令.Location 指令,是用来为匹配的 URI 进行配置,URI 即语法中的”/uri/”,可以是字符串或 ...
- Nginx安装与配置文件解析
导读 Nginx是一款开放源代码的高性能HTTP服务器和反向代理服务器,同时支持IMAP/POP3代理服务,是一款自由的软件,同时也是运维工程师必会的一种服务器,下面我就简单的说一下Nginx服务器的 ...
- nginx源代码分析--配置文件解析
ngx-conf-parsing 对 Nginx 配置文件的一些认识: 配置指令具有作用域,分为全局作用域和使用 {} 创建其他作用域. 同一作用域的不同的配置指令没有先后顺序:同一作用域能否使用同样 ...
- Nginx入门篇(二)之Nginx部署与配置文件解析
一.Nginx编译安装 ()查看系统环境 [root@localhost tools]# cat /etc/redhat-release CentOS Linux release (Core) [ro ...
- Centos7 nginx的目录结构与nginx主配置文件解析
一.nginx的目录结构 [root@node nginx_116]# ls client_body_temp conf fastcgi_temp html logs proxy_temp ...
- Nginx配置文件及模块解析
一.Nginx是什么? Nginx是一个基于c语言开发的高性能http服务器及反向代理服务器.由俄罗斯的程序设计师Igor Sysoev所开发,官方测试nginx能够支支撑5万并发链接,并且cpu.内 ...
随机推荐
- javascript 倒计时代码
<script language="javascript" type="text/javascript"> var interval = 1000; ...
- 比file_get_contents稳定的curl_get_contents
相信使用过file_get_contents函数的朋友都知道,当获取的$url访问不了时,会导致页面漫长的等待,甚至还能导致PHP进程占用CPU达100%,因此这个函数就诞生了 分享一个实际在用的函数 ...
- 解决Android ListView 和 ScrollView 共存时冲突 问题 方法其一
转载请注明出处: http://www.goteny.com/articles/2013/11/8.html http://www.cnblogs.com/zjjne/p/3428480.html 当 ...
- android Uri获取真实路径转换成File的方法
Uri uri = data.getData(); String[] proj = { MediaStore.Images.Media.DATA }; Cursor actualimagecursor ...
- android ids.xml资源的使用
ids.xml文件例子: XML file saved at res/values/ids.xml: 使用方式: 一:
- Alias Method解决随机类型概率问题
举个例子,游戏中玩家推倒了一个boss,会按如下概率掉落物品:10%掉武器 20%掉饰品 30%掉戒指 40%掉披风.现在要给出下一个掉落的物品类型,或者说一个掉落的随机序列,要求符合上述概率. 一般 ...
- 【HDOJ】3518 Boring Counting
后缀数组2倍增可解. #include <cstdio> #include <cstring> #include <cstdlib> #define MAXN 10 ...
- jquery获取表格中特定列
jQuery().text() 如果有一个表格,我们要用jquery获取特定列,则需要修改列的索引值就好了,此句代码获取的是页面的第10列
- CDH-5.4.3离线安装
使用CM离线安装CDH-5.4.3,如下: cdh5.4.3安装 配置/etc/hosts vim /etc/hosts 192.168.10.1 s1 192.168.10.2 s2 192.168 ...
- <有序数组>转化为<按二分法遍历顺序排列的数组>(C++实现)
在进行参数试错时,通常将可能的参数由小到大排列一个个进行测试,这样的测试顺序很多时候不太合理,因此写了一个按二分法遍历顺序排列的算法,通常能更快的找到合适的参数.代码如下: /************ ...