nginx配置优化-生产环境应用版
user www www;
worker_processes auto;
worker_cpu_affinity auto;
error_log /usr/local/nginx/logs/error.log warn;
pid nginx.pid;
worker_rlimit_nofile 65535; events
{
use epoll;
multi_accept on;
worker_connections 65530;
} http
{
include mime.types;
default_type application/octet-stream;
charset utf-8;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 40s;
client_header_timeout 10;
client_body_timeout 10;
client_header_buffer_size 4k;
server_names_hash_bucket_size 128;
large_client_header_buffers 4 32k;
client_max_body_size 100m;
send_timeout 10;
reset_timedout_connection on;
open_file_cache max=102400 inactive=20s;
open_file_cache_min_uses 1;
open_file_cache_valid 30s; fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 128k; #出现110错误需要更改相应大小值
fastcgi_buffers 256 128k;
fastcgi_busy_buffers_size 256k; #fastcgi_buffers的两倍
fastcgi_temp_file_write_size 256k; #fastcgi_buffers的两倍 proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 128k; #出现110错误需要更改相应大小值
proxy_buffers 256 128k;
proxy_busy_buffers_size 256k; #proxy_buffers的两倍
proxy_temp_file_write_size 256k; #proxy_buffers的两倍 gzip on;
gzip_min_length 256;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 5;
gzip_disable "MSIE [1-6]\.";
gzip_proxied any;
gzip_types
application/atom+xml
application/javascript
application/json
application/ld+json
application/manifest+json
application/rss+xml
application/vnd.geo+json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/bmp
image/svg+xml
image/x-icon
text/cache-manifest
text/css
text/plain
text/vcard
text/vnd.rim.location.xloc
text/vtt
text/x-component
text/x-cross-domain-policy; log_format access '{"@timestamp":"$time_iso8601",'
'"host":"$server_addr",'
'"clientip":"$remote_addr",'
'"size":$body_bytes_sent,'
'"responsetime":$request_time,'
'"upstreamtime":"$upstream_response_time",'
'"upstreamhost":"$upstream_addr",'
'"http_host":"$host",'
'"url":"$uri",'
'"xff":"$http_x_forwarded_for",'
'"referer":"$http_referer",'
'"agent":"$http_user_agent",'
'"status":"$status"}';
access_log /usr/local/nginx/logs/access.log access;
server {
listen 80;
server_name localhost;
index index.html index.php;
root /data/www/default;
access_log /usr/local/nginx/logs/access.log;
error_log /usr/local/nginx/logs/error.log; if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
} location ~ \.php {
expires -1;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
nginx配置优化-生产环境应用版的更多相关文章
- php配置优化-生产环境应用版
[global] error_log = log/php-fpm.log log_level = warning emergency_restart_threshold = 10 emergency_ ...
- Nginx配置优化详解
如果你已经安装过Nginx并在生产环境中使用,那么Nginx配置优化你一定也要做,这样才能看到Nginx性能,本文就从基本配置优化开始到高层配置教你如何优化Nginx 大多数的Nginx安装指南告诉你 ...
- CentOS8本地安装Redash中文版,并且配置为生产环境
Centos8内置的Python为3.6.8版本,以下是在内置Python3.6.8基础上的安装步骤.由于安装多版本Python会导致系统底层库需要下载源码重新编译,比较麻烦,不建议在多版本Pytho ...
- Tomcat与Jre绿色环境配置(生产环境)
Tomcat与Jre绿色环境配置(生产环境) 博客分类: Apache Java jreapachetomcat Tomcat运行时需要jre的支持,一般有两种方式,一种是用jdk带的jre,另一种 ...
- nginx 配置优化的几个参数
nginx 配置优化的几个参数 2011-04-22 本文地址: http://blog.phpbean.com/a.cn/7/ --水平有限欢迎指正-- -- 最近在服务器上搞了一些nginx 研究 ...
- PHP+FastCGI+Nginx配置PHP运行环境方法
PHP+FastCGI+Nginx配置PHP运行环境 Nginx不支持对外部程序的调用,所以必须通过FastCGI接口实现对外部程序的调用从而实现对客户端动态页面请求的处理. CGI的英文全称为Com ...
- Nginx配置优化参考
Nginx配置优化参考 ...
- nginx配置优化提高并发量
1 nginx配置优化提高并发量 worker_processes 2; 这个按照CPU的核数来决定 2 worker_connections 65535; 这个一般设置65535即可 每个进程允许的 ...
- nginx 和 tomcat 生产环境配置 建议和方法
参考 以下内容: http://blog.csdn.net/lifetragedy/article/details/7708724 一. nginx参数调优 worker_processes 3; ...
随机推荐
- Maven with Scala
下面是一个在Maven使用Scala的pom.xml <?xml version="1.0" encoding="UTF-8" standalone=&q ...
- xampp 在 windows下 配置 fcgi... 和 opcache 等 优化操作
首先 修改 xampp 的 httpd.conf:(底部加入.方便修改) #fast-cgi 模式 LoadModule fcgid_module modules/mod_fcgid.so <I ...
- Codeforces-Salem and Sticks(枚举+思维)
Salem gave you nn sticks with integer positive lengths a1,a2,-,ana1,a2,-,an. For every stick, you ca ...
- 8.11zju集训日记
今天的比赛打得很不好,前一个小时的看的题目都非常难,没有做出题目,中期看到两道题,一道题是我读题,金大佬solo的,另外一道题是金大佬读题,写了代码但wa了,然后我和zz找bug,最后发现答案的范围是 ...
- 毕业设计 python opencv实现车牌识别 界面
主要代码参考https://blog.csdn.net/wzh191920/article/details/79589506 GitHub:https://github.com/yinghualuow ...
- java mybatis学习一
1.引入maven包 和 导入 sqljdbc包 <dependency> <groupId>org.apache.ibatis</groupId> <art ...
- ansible部署,规划
部署管理服务器 第一步:先检查有没有ssh服务 [root@iZm5eeyc1al5vzh8bo57zyZ ~]# rpm -qf /etc/init.d/sshd openssh-server-5. ...
- 读书印记 - 《文革前的邓小平:毛XX的副帅》
开始看才发现这居然是本学术著作,阅读难度系数比小说.传记要很多,相比于小说的人物心理.传记的故事套路,这本书的基本写法是举一大坨材料来描述当时的事实然后稍微发表一点学术观点.....我对这个内容本身挺 ...
- Vue.js-----轻量高效的MVVM框架(一、初识Vue.js)
1.什么是Vue.js? 众所周知,最近几年前端发展非常的迅猛,除各种框架如:backbone.angular.reactjs外,还有模块化开发思想的实现库:sea.js .require.js .w ...
- java多线程(三)
1.1什么的多线程的安全问题? 多个线程对共享资源进行访问时,引起共享资源不一致的问题. 1.2一般解决多线程安全问题的解决方案有哪些? 1.2.1 同步方法 public synchroniz ...