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 配置文件解析(一)的更多相关文章

  1. nginx配置文件解析工具

    最近花了一些时间自己实现解析nginx配置文件的功能,这里有个工具先记下以后用. https://github.com/nginxinc/crossplane

  2. Nginx配置文件解析

    user nginx nginx; #定义Nginx运行的用户和用户组 worker_processes 1; #nginx进程数,建议设置为等于CPU总核心数 worker_rlimit_nofil ...

  3. Nginx 配置文件解析

    nginx 整理 nginx 配置主要是分为4个部分 1.main 全局设置2.server 主机设置 -- 指定主机与端口3.upstream 负载均衡服务器设置 -- 反向代理设置:4.locat ...

  4. Nginx安装部署以及配置文件解析

    Nginx 中的 Location 指令 是NginxHttpCoreModule中重要指令.Location 指令,是用来为匹配的 URI 进行配置,URI 即语法中的”/uri/”,可以是字符串或 ...

  5. Nginx安装与配置文件解析

    导读 Nginx是一款开放源代码的高性能HTTP服务器和反向代理服务器,同时支持IMAP/POP3代理服务,是一款自由的软件,同时也是运维工程师必会的一种服务器,下面我就简单的说一下Nginx服务器的 ...

  6. nginx源代码分析--配置文件解析

    ngx-conf-parsing 对 Nginx 配置文件的一些认识: 配置指令具有作用域,分为全局作用域和使用 {} 创建其他作用域. 同一作用域的不同的配置指令没有先后顺序:同一作用域能否使用同样 ...

  7. Nginx入门篇(二)之Nginx部署与配置文件解析

    一.Nginx编译安装 ()查看系统环境 [root@localhost tools]# cat /etc/redhat-release CentOS Linux release (Core) [ro ...

  8. Centos7 nginx的目录结构与nginx主配置文件解析

    一.nginx的目录结构 [root@node nginx_116]# ls client_body_temp  conf  fastcgi_temp  html  logs  proxy_temp ...

  9. Nginx配置文件及模块解析

    一.Nginx是什么? Nginx是一个基于c语言开发的高性能http服务器及反向代理服务器.由俄罗斯的程序设计师Igor Sysoev所开发,官方测试nginx能够支支撑5万并发链接,并且cpu.内 ...

随机推荐

  1. IIS7.5 APPCMD 简单用法及示例

    1 添加应用程序进城池 appcmd.exe add apppool  /name:test.com  /managedRuntimeVersion:"v4.0" /managed ...

  2. bat(传参情况下)取得当前bat所在的目录路径

    在传参情况下,取得bat文件所在的目录路径,可以使用: %~dp0 说明: 01.所谓传参情况是指,将某个文件拖放到bat文件上并放开.此种情况下执行的bat命令就是有带参数的. 02.上面末尾的0是 ...

  3. NVIDIA 显卡温度提示过高,显卡温度高99度怎么办?

    你可能没有在意您的NVIDIA(英伟达)显卡温度,那么你就不会知道显卡温度过高如何导致的呢?也不会知道如果去解决显卡温度过高的问题了,在此我希望在电脑玩游戏或者在办公中电脑速度快慢,或者发热的情况下, ...

  4. MarkdownPad 使用 MathJax

    一直想要在MarkdownPad中支持数学公式,终于找到了一个方法: 在MarkdownPad中,点击"Tools > Options > Advanced > HTML ...

  5. d3可视化实战00:d3的使用心得和学习资料汇总

    最近以来,我使用d3进行我的可视化工具的开发已经3个月了,同时也兼用其他一些图表类库,自我感觉稍微有点心得.之前我也写过相关文章,我涉及的数据可视化的实现技术和工具,但是那篇文章对于项目开发而言太浅了 ...

  6. JavaScript 比较操作符,严格比较===

    JavaScript 有两种比较方式:严格比较运算符和转换类型比较运算符.对于严格比较运算符(三个 =)来说,为ture的情况是仅当两个操作数拥有相同的类型,而对于被广泛使用的比较运算符(两个 =)来 ...

  7. App项目升级Xcode7&iOS9(续) - This bundle is invalid. The bundle identifier contains disallowed characters

    金田 iOS 9发布已经有2月有余,现在Xcode已经有升级到Xcode7.1,开发环境安装等一系列相关的流程,以及Xcode 7 & iOS 9升级相关的一些部分,在这里就不再多加赘述(详见 ...

  8. Android把图片保存到SQLite中

    1.bitmap保存到SQLite 中 数据格式:Blob db.execSQL("Create table " + TABLE_NAME + "( _id INTEGE ...

  9. HDU5141--LIS again (LIS变形)

    题意一个序列的LIS为MAX, 求连续子序列的LIS为MAX的个数. 先求出LIS,记录以a[i]结尾的LIS的长度,以及LIS起始位置(靠右的起始位置). 然后线性扫一遍,,线段树与树状数组的差距还 ...

  10. paip.输入法编程---带ord gudin去重复-

    paip.输入法编程---带ord gudin去重复- 作者Attilax ,  EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.n ...