杨新春

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

user daemon daemon;
worker_processes 2;
error_log logs/nginx_error.log info;
pid logs/nginx.pid;
worker_rlimit_nofile 204800;
events
{
use epoll;
worker_connections 204800;
}
http
{
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 4k;
large_client_header_buffers 8 4k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 3;
fastcgi_cache_path /usr/local/nginx/fastcgi_cache levels=2:2 keys_zone=phpcache:30m inactive=5m;
fastcgi_cache phpcache;
fastcgi_cache_valid 200 302 1h;
fastcgi_cache_valid 301 1d;
fastcgi_cache_valid any 1m;
fastcgi_cache_min_uses 1;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_cache_key http://$host$request_uri;

fastcgi_connect_timeout 60;
fastcgi_send_timeout 70;
fastcgi_read_timeout 70;
fastcgi_buffer_size 4k;
fastcgi_buffers 64 4k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;

open_file_cache max=204800 inactive=20s;
open_file_cache_min_uses 1;
open_file_cache_valid 30s;
tcp_nodelay on;
gzip on;
gzip_min_length 1k;
gzip_buffers 16 4k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;


server {
listen 80;
server_name www.test.com;
root /www/wwwroot;
index index.html index.htm index.php;

error_page 500 502 503 504 /error.html;
error_page 404 =200 /404.html;

location /status
{
stub_status on;
}
location ~ .*\.php?$ {
fastcgi_pass 127.0.0.1:9000; //不能用socket,连结数会更少
fastcgi_index index.php;
fastcgi_intercept_errors on;
include fastcgi.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)?$ {
expires 7d;
}

location ~ .*\.(js|css)?$ {
expires 1d;
}

location = /status {
stub_status on;
access_log off;
}

log_format access '$remote_addr -- $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /www/log/access.log access;

}
}


============================================================

net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024 65000

 

posted on 2017-09-15 13:57  杨新春  阅读(195)  评论(0编辑  收藏  举报