首页 > 其他 > 详细

Nginx基础 - 通用优化配置文件

时间:2020-07-10 17:09:58      阅读:69      评论:0      收藏:0      [点我收藏+]

[root@nginx ~]# cat nginx.conf
user nginx;
worker_processes auto;
worker_cpu_affinity auto;

error_log /var/log/nginx/error.log warn;
pid /run/nginx.pid;
#调整至1w以上,负荷较高建议2-3w以上
worker_rlimit_nofile 35535;

events {
use epoll;
#限制每个进程能处理多少个连接请求,10240x16
worker_connections 10240;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# 统一使用utf-8字符集
charset utf-8;

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;

# Core module
sendfile on;
# 静态资源服务器建议打开
tcp_nopush on;
# 动态资源服务建议打开,需要打开keepalived
tcp_nodelay on;
keepalive_timeout 65;

# Gzip module
gzip on;
gzip_disable "MSIE [1-6]\.";
gzip_http_version 1.1;

# Virtal Server
include /etc/nginx/conf.d/*.conf;
}

Nginx基础 - 通用优化配置文件

原文:https://www.cnblogs.com/Wang-Hongwei/p/13279788.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!