nginx配置文件解释
#全局配置
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;#运行nginx的用户
worker_processes auto;#工作进程的可以根据CPU的核心总数来设置
error_log /var/log/nginx/error.log;#错误日志的存放位置及输出级别
pid /run/nginx.pid;#nginx进程PID存储文件的位置,存放nginx进程的ID号
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
#配置工作模式
events {
worker_connections 1024;#每个进程最大处理的连接数,一个进程最多接受多少个连接
}
#http配置
http {
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;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;#超时时间(稍),超过服务器就断开连接
types_hash_max_size 2048;
include /etc/nginx/mime.types;#支持的媒体类型
default_type application/octet-stream;#默认的类型
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;#引入conf.d/下的配置文件,包含虚拟主机的配置,可以定义多个
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
#proxy_pass http://localhost:5000;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2 default_server;
# listen [::]:443 ssl http2 default_server;
# server_name _;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# location / {
# }
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}
nginx配置文件解释的更多相关文章
- Nginx 配置文件解释及简单配置
Nginx配置文件大致分为以下几个块 1.全局块:配置影响nginx全局的指令.一般有运行nginx服务器的用户组,nginx进程pid存放路径,日志存放路径,配置文件引入,允许生成worker pr ...
- Nginx配置文件具体配置解释
Nginx配置文件具体配置解释 #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_processes 8; #全局错 ...
- 【Nginx笔记】nginx配置文件具体解释
本文主要对nginx的配置做重点说明,关于nginx的其他基本概念.建议參考官网描写叙述.这里推荐Nginx Beginner's Guide这篇文档.对刚開始学习的人高速认识nginx非常有帮助. ...
- Nginx安装及配置文件解释
安装nginx,还是在mac上面用brew比较方便. 首先,brew install nginx,提示改权限 sudo chown -R $(whoami) /usr/local 然后brew ins ...
- nginx配置文件中的location理解
关于一些对location认识的误区 1. location 的匹配顺序是"先匹配正则,再匹配普通". 矫正: location 的匹配顺序其实是"先匹配普通,再匹配正则 ...
- nginx配置:支持phpfastcgi,nginx和php-cgi通信,部分nginx常量解释
支持phpfastcgi的配置如下: server { listen 8000; server_name localhost; root F:/home/projects/test; index in ...
- Nginx配置文件语法教程
Nginx的配置文件在一开始可能真的不太好理解,就像当初开始使用Apache那样,像JSON但却不是.可以说是Nginx的一种专门语言,仅为Nginx服务的. 市面上基本都是写了一点不写一点的教程,基 ...
- Nginx配置文件nginx.conf中文详解(转)
######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_ ...
- 查看nginx配置文件路径
进入nginx安装目录(我的是/usr/local/nginx-1.7.8/) 进入sbin目录,输入 ./nginx -t查看nginx配置文件路径以及该文件语法是否正确 ./nginx -v查看n ...
随机推荐
- SpringMVC参数传递方案
SpringMVC参数传递方案 登录 @PostMapping("/login") @ResponseBody public Map login(String username, ...
- git账户配置
一.生成github的ssh key ssh-keygen ssh-keygen -t rsa -f ~/.ssh/zzf073_rsa -C zzf073@163.com 二.配置账户公钥 1.查看 ...
- [转] console.log的高级用法
//基本用法 console.log('最常见用法\n换行'); console.error('输出错误信息 会以红色显示'); console.warn('打印警告信息 会以黄色显示'); cons ...
- .NET[C#]使用LINQ从List<T>集合中获取最后N条数据记录的方法有哪些?
https://codedefault.com/2018/using-linq-to-get-the-last-n-elements-of-a-collection-in-csharp-applica ...
- Windows 10 更新补丁后Visual Studio 2017 运行项目出现错误
问题: 今天更新了Windows 10(版本 1709)推送最新补丁后,打开Visual Studio 2017运行Web项目,都出现“指定的参数超出有效值的范围 参数名:site”,如下图: 解决方 ...
- SQLServer之服务器连接
目录 SQL Server Management Studio连接 CMD命令行窗口连接 通用数据连接文件连接 SQL Server Management Studio连接 定义 SQL Server ...
- 调试 Go 的代码生成
原文:https://studygolang.com/articles/19815 这是一个创建于 2019-04-17 23:12:26 的文章,其中的信息可能已经有所发展或是发生改变. 2016 ...
- 《EOPL》 : CPS风格真是神奇
计算的栈好像可以随便跳转了一样. Exception 的 try/catch , resume机制都可以借此实现 还可以实现 Erlang中的 spawn,线程调度器,以及基本的 Mutex 同步机制
- python 正则表达式、re
正则表达式是一个特殊的字符序列,它能帮助你方便的检查一个字符串是否与某种模式匹配. 参考链接:https://www.runoob.com/python/python-reg-expressions. ...
- ELK + kafka 分布式日志解决方案
概述 本文介绍使用ELK(elasticsearch.logstash.kibana) + kafka来搭建一个日志系统.主要演示使用spring aop进行日志收集,然后通过kafka将日志发送给l ...