首页 技术 正文
技术 2022年11月8日
0 收藏 378 点赞 1,692 浏览 1515 个字
#使用的用户和组
user www www;
#指定工作衍生进程数(一般等于CPU的总核数或总核数的两倍)
worker_processes 8;
#指定错误日志存放的路径,错误日志的记录级别可为debug,info,notice,warn,error,crit
error_log error.log crit;
#指定pid文件存放的路径
pid nginx.pid;
#指定文件描述符的数量
worker_rlimit_nofile 51200;
events{
#使用的I/O模型,Linux系统推荐使用epoll模型,FreeBSD推荐使用kqueue模型
#在我的Mac OSX 11系统中报错 invalid event type "kueue"
#use kueue;
#允许连接数
worker_connections 51200;
}
http{
#根据自己的文件目录,配置mime.types文件路径
#include path/to/mime.types;
default_type application/octet-stream;
#设置使用的字符集,如果一个网站有多种字符集,请不要随便设置,应让程序员在HTML代码中通过meta标签进行设置
#charset gb2312;
#日志格式
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 access.log main;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
#设置客户端能够上传的文件大小
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 61k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
#开启gzip压缩
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#limit_zone crawler $binary_remote_addr 10m;
server{
listen 80;
server_name www.yourdomain.com yourdomain.com;
index index.html index.htm index.php;
root /path/to/root;
#limit_conn crawler 20;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
}
}

 转载于:http://www.siguoya.name/home/article/41 

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,413
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,186
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905