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.内 ...
随机推荐
- 【结构型】Bridge模式
桥接模式是为了将对象的抽象与实现分离,使得它们可以独立变化.简简单单的一句话,却已经是站在了更高抽象层面上来看待.设计.解决问题.平常我们多是对具体问题进行分析.抽象,然后就开始设计,这对多数情况下基 ...
- xml约束之schema
使用名称空间引入Schema : 通常需要在Xml文档中的根结点中使用schemaLocation属性来指定. <itcast:书架 xmlns:itcast="http://www. ...
- IOS开发之免费证书+不越狱真机调试
本文转自:http://www.cnblogs.com/weii/p/4688299.html 苹果发布Xcode7后, 开放了普通的AppleID也能真机调试,非$99 或 $299, 只要能上 ...
- Acdream Mengzhu
http://acdream.info/problem?pid=1006 #include <cstdio> #include <cmath> #include <cst ...
- BZOJ1119: [POI2009]SLO
1119: [POI2009]SLO Time Limit: 30 Sec Memory Limit: 162 MBSubmit: 379 Solved: 181[Submit][Status] ...
- 2015第27周三Java内存模型
自己写的代码,6个月不看也是别人的代码,自己学的知识也同样如此,学完的知识如果不使用或者不常常回顾,那么还不是自己的知识. 要认识java线程安全,必须了解两个主要的点:java的内存模型,java的 ...
- HDU_2033——时间加法
Problem Description HDOJ上面已经有10来道A+B的题目了,相信这些题目曾经是大家的最爱,希望今天的这个A+B能给大家带来好运,也希望这个题目能唤起大家对ACM曾经的热爱.这个题 ...
- apache shiro内置过滤器 标签 注解
内置过滤器 anon(匿名) org.apache.shiro.web.filter.authc.AnonymousFilter authc(身份验证) org.apache.shiro ...
- javax.security.auth.login.LoginException: Error during resolve 异常
登陆TIM时本地抛此异常,测试环境正常 需要重启测试环境机器以后,本地才可以登陆成功 求大神帮忙解决: INFO: Client code attempting to load security co ...
- C++ lambda 表达式传递的变量默认不可变
我遇到例如以下问题: int count=0; listener->onTouchMoved=[count](Touch* t,Event* e){ count++; log("onT ...