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.内 ...
随机推荐
- Pycharm在创建py文件时,如何自动添加文件头注释(类似于钩子特性)?
在每次新建一个py文件的时候 1 如何自动添加/usr/bin/env python2 自动添加 coding=utf8 操作方法: File->settings->Editor-> ...
- 关于多本小说站的SEO—从”易读中文网”获得的心得体会
从目前国内的网站流量来说,电影站,小说站,游戏站等的流量占总流量的比例还是很高的,许多站长把目光投入到了这几个方面,本文就着重来说对于小说站,尤其是多本小说站的SEO心得体会! 对于小说站来说,只要排 ...
- 如何用PowerPoint制作闪烁的星星
在PPT中,PPT动画说是幻灯片PPT中的精华是当之无愧的!ppt文件有了动画,犹如插上翅膀的鸟,让PPT的色彩衍生出了更多的特色.只要你的ppt动画效果制作的对,你的幻灯片将明显与众不同,观众也更容 ...
- Bundle类
1.新建一个Bundle类 Bundle bundle=new Bundle();2.Bundle类中放入数据(key-value的形式,另一个Activity里面取数据的时候,通过key值找出对应的 ...
- Oracle 判断 并 手动收集 统计信息 脚本
CREATE OR REPLACE PROCEDURE SchameB.PRC_GATHER_STATS AUTHID CURRENT_USER IS BEGIN SYS.DBMS_STATS.GAT ...
- AC自动机修正
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #inc ...
- 为什么使用Redis
原文地址:http://igoder.iteye.com/blog/1969848 先解释一下软件编程中常见的一些概念: 抽象先于具象.这个抽象并非虚无的抽象,而是指事物尚未分化为具象之前的那个前体存 ...
- HDU 5505 - BestCoder Round #60 - GT and numbers
题目链接 : http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=641&pid=1002 思路 : N有若 ...
- 好吧,使用sql实现Dijkstra算法
我本来不想做这么蛋疼的事情的,可是更蛋疼的是我看了王大神的博客然后中毒了!我发誓再!不!看!了!不过问题本身还是有一点意思的,正好学过图论没有实现过dijkstra,刚好在慕课上又学了一点pl/sql ...
- spring中获取Bean
在测试类中我们获取已经装配给容器的Bean的方法是通过ApplicationContext,即 ApplicationContext ac=new ClassPathXmlApplicationCon ...