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; ...
随机推荐
- php 常见递归实例
//计算数组{1,1,2,3,5,8.......} 第n位值 function Process1($i){ if ($i == 0) return 0; if ($i == 1) return 1; ...
- Apache 403 错误。。
两个方面.. 一: httpd.conf 是否有 <directory '/www'></directory> 是否有 Deny from all 或者 Require l ...
- Canvas制作动态进度加载水球
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Codeforces Round #316 (Div. 2) A
Description The country of Byalechinsk is running elections involving n candidates. The country cons ...
- 通过JS,按照原比例控制图片尺寸
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Con ...
- Python 内置的GUI库tkinter方法在py2和py3中的更改
参考资料: https://docs.python.org/3.4/library/tkinter.html#tkinter-moduleshttps://docs.python.org/2.7/ ...
- py---------面向对象基础篇
引子 你现在是一家游戏公司的开发人员,现在你需要开发一款叫做<人猫大战>的小游戏,你就思考呀,人猫大战,那至少需要两个角色,一个是人,一个是猫,且人和猫有不同的技能,比如人拿棍打狗,狗可以 ...
- 利用Intent.ACTION_SEND进行分享
安卓系统本身可以很简便的实现分享功能,因为我们只需向startActivity传递一个ACTION_SEND的Intent,系统就为我们弹出一个应用程序列表.其实在系统的文件管理器中,这应该是我们常用 ...
- ubuntu15.04 xampp 安装memcache
要ThinkPHP3.2里由于要用到 memcache 缓存, 如果没有配置memcache,会报错,说系统支持 memcache. 所在配置的时候有点问题,现在解决了,现把它记录下来,以便以后查阅之 ...
- Beam概念学习系列之PCollection数据集
不多说,直接上干货! PCollection数据集 PCollection是Apache Beam中数据的不可变集合,可以是有限的数据集合也可以是无限的数据集合. 有限数据集,这种一般对应的是批处理 ...