nginx.conf 详细
##定义nginx运行的用户各用户组
user nginx nginx;
##nginx进程数,建议设置与cpu核心数一致
worker_processes 1;
##全局错误日志定义类型[ debug | info | notice | warn | error | crit ]
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
##进程文件
#pid logs/nginx.pid;
##工作模式与连接数上限
events {
##单个进程的最大连接数
worker_connections 65535;
}
##设置http服务器
http {
##引入外置配置文件
include /etc/nginx/conf.d/*.conf;
##文件扩展名与文件类型映射表
include mime.types;
##默认文件类型
default_type application/octet-stream;
##默认编码
#charset utf-8;
##服务器名字的hash表大小
#server_name_hash_bucket_size 128;
##上传文件大小限制
#client_header_buffer_size 32K;
##设定请求缓存
#large_client_header_buffers 4 64K;
##最大缓存
client_max_body_size 8M;
##日志格式设定
#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 logs/access.log main;
##开启高效文件传输模式sendfile指令指定nginx是否调用sendfile函数来输出文件,对于普通应用设为 on,如果用来进行下载等应用磁盘IO重负载应用,可设置为off,以平衡磁盘与网络I/O处理速度,降低系统的负载。注意:如 果图片显示不正常把这个改成off。
sendfile on;
##开启目录列表访问,合适下载服务器,默认关闭
#autoindex on;
##防止网络阻塞
#tcp_nopush on;
##防止网络阻塞
#tcp_nodelay on;
##长链接超时时间,单位是秒,为0,无超时
keepalive_timeout 65;
##gzip模块设置
##开启gzip压缩输出
#gzip on;
##最小压缩文件大小
#gzip_min_length 1k;
##压缩缓冲区
#gzip_buffers 4 16k;
##压缩版本(默认1.1,前端如果squid2.5请使用1.0)
#gzip_http_version 1.0;
##压缩等级
#gzip_comp_level 2;
##压缩类型,默认就已经包含了textxml,默认不用写,写上去也没有问题,会有一个warn
#gzip_types text/plain application/x-javascript text/css application/xml;
#gzip_vary on;
##开启连接限制ip连接数使用
#limit_zone crawler $binary_remote_addr 10m;
##FastCGI相关参数是为了改善网站的性能:减少资源占用,提高访问速度。
fastcgi_connect_timeout 300;
listen 80;
##域名可以有多个,用空格隔开
server_name localhost;
#charset koi8-r;
##定义本虚拟主机的访问日志
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
##图片缓存时间设置
location ~.*.(gif|jpg|jpeg|png|bmp|swf)${
expires 10d;
}
##js和CSS缓存时间设置
location ~.*.(js|css)?${
expires 1h;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#error_page 500 502 503 504 /50x.html;
location = /50x.html {
root 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$ {
# 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.conf 详细的更多相关文章
- Nginx配置文件nginx.conf详细说明
Nginx配置文件nginx.conf详细说明 #worker_processes 8; #worker_cpu_affinity 00000001 00000010 00000100 0000100 ...
- Nginx配置文件nginx.conf详细说明文档
在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集于网络. user www-data; #运行用户 worker_pro ...
- nginx配置文件nginx.conf超详细讲解
#nginx进程,一般设置为和cpu核数一样worker_processes 4; #错误日志存放目录 error_log /data1/logs/er ...
- Nginx 1.10.1 版本nginx.conf优化配置及详细注释
Nginx 1.10.1 的nginx.conf文件,是调优后的,可以拿来用,有一些设置无效,我备注上了,不知道是不是版本的问题,回头查一下再更正. #普通配置 #==性能配置 #运行用户 user ...
- Nginx.conf 配置文件详细说明
在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集与网络. #运行用户user www-data; #启动进程,通常设置成和cpu的数量相等worker_process ...
- 详细的nginx.conf中文资料整理
整理来源: https://blog.csdn.net/tjcyjd/article/details/50695922 整理结果 Nginx的配置文件nginx.conf配置详解如下: #Nginx用 ...
- Nginx nginx.conf配置文件详细说明
在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集与网络. #运行用户user www-data; #启动进程,通常设置成和cpu的数量相等worker_process ...
- nginx.conf配置及优化相关
nginx.conf配置文件内容 user www www; worker_processes ; worker_rlimit_nofile ; error_log /data/nginx/logs/ ...
- 【转】Nginx配置文件详细说明
Nginx配置文件详细说明 在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集与网络. #运行用户user www-data; #启动进程,通常设置成和cpu的数量相等 ...
随机推荐
- 洛谷——P1754 球迷购票问题
题目背景 盛况空前的足球赛即将举行.球赛门票售票处排起了球迷购票长龙. 按售票处规定,每位购票者限购一张门票,且每张票售价为50元.在排成长龙的球迷中有N个人手持面值50元的钱币,另有N个人手持面值1 ...
- 洛谷——P1327 数列排序
P1327 数列排序 题目描述 给定一个数列{an},这个数列满足ai≠aj(i≠j),现在要求你把这个数列从小到大排序,每次允许你交换其中任意一对数,请问最少需要几次交换? 输入输出格式 输入格式: ...
- SPOJ BGSHOOT - Shoot and kill (线段树 区间修改 区间查询)
BGSHOOT - Shoot and kill no tags The problem is about Mr.BG who is a great hunter. Today he has gon ...
- sdoi2018酱油鸡
ruand1滚粗啦,然后过来写游记 四月是你の省选... day -1 老师突然告诉我们说 day2 回来参加月考,心态爆炸. day0 坐车,颓,和队爷zpd补了b站翻唱2017top100,晚上收 ...
- [Codeforces 7E] Defining Macros
Link:http://codeforces.com/problemset/problem/7/E Brief Introduction:一个表达式由多个“Macros”组成,每个Macro都为一个整 ...
- [SHOI2009] 交通网络
简单最短路计数. #include<bits/stdc++.h> #define ll long long using namespace std; #define D double co ...
- 【神奇の做法】bzoj2456 mode
题解:http://www.tuicool.com/articles/BfQBzif #include<cstdio> using namespace std; int n,x,ans,t ...
- NPOI读取Excel2003,2007
using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Lin ...
- 【R笔记】glm函数报错原因及解析
R语言glm函数学习: [转载时请注明来源]:http://www.cnblogs.com/runner-ljt/ Ljt 作为一个初学者,水平有限,欢迎交流指正. glm函数介绍: glm(for ...
- 网络编程-UDP
代码部分--UDP传输 * 1.发送Send * 创建DatagramSocket, 随机端口号 * 创建DatagramPacket, 指定数据, 长度, 地址, 端口 * 使用DatagramSo ...