本文共 2297 字,大约阅读时间需要 7 分钟。
worker_processes 4; # 设为服务器核心数# 一个进程绑定一个核心# worker_cpu_affinity 0001 0010 0100 1000; # 查看单个CPU核心数# grep -c processor /proc/cpuinfo# 4# 查看CPU总颗数# grep 'physical id' /proc/cpuinfo | sort | uniq | wc -l# 2
events { use epoll;...
worker_rlimit_nofile 65535; # 最大打开文件数events { worker_connections 4096; # 最大并发量=worker_connections*worker_processor...
http { sendfile on; tcp_nopush on; tcp_nodelay on;...
http { keepalive_timeout 60; # 客户端连接保持会话超过60秒,服务器关闭该连接 client_header_timeout 15; # 读取客户端请求头数据超过15秒,服务器返回408错误 client_body_timeout 15; # 读取客户端请求主体数据超过15秒,服务器返回408错误 send_timeout 25; # 客户端和服务器建立连接超过25秒不发送任何数据,服务器关闭该连接...
http { client_max_body_size 8m;...
http { fastcgi_connect_timeout 240; fastcgi_send_timeout 240; fastcgi_read_timeout 240; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; # fastcgi_cache_path /data/ngx_fcgi_tmp; fastcgi_cache_path /data/ngx_fcgi_cache levels=2:2; keys_zone=ngx_fcgi_cache:512m inactive=1d max_size=40g; ...localtion ~.*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; fastcgi_cache ngx_fcgi_cache; fastcgi_cache_valid 200 302 1h; fastcgi_cache_valid 301 1d; fastcgi_cache_valid any 1m; fastcgi_cache_min_users 1; fastcgi_cache_use_stale error timeout invalid_header http_500; fastcgi_cache_key http://$host$reques uri;...
# expires模块控制nginx服务器应答时的Expires头内容和Cache-Control头的max-age指令,设置缓存有效期location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d;}location ~ .*\.(js|css)?$ { expires 12h;}
# 不记录不需要的访问日志location ~.*\.(js|jpg|JPG|jpeg|JPEG|css|bmp|gif|GIF)$ { access_log off;}# 降低日志目录权限chmod -R 600 /usr/loacl/nginx/logs
http { gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss; gzip_vary on;...
转载地址:http://elykl.baihongyu.com/