记事本做网站怎么加背景图,抚顺外贸网站建设,医院网站系统源码,大连招投标网官网# nginx不同于apache服务器#xff0c;当进行了大量优化设置后会魔术般的明显性能提升效果
# nginx在安装完成后#xff0c;大部分参数就已经是最优化了#xff0c;我们需要管理的东西并不多#user nobody;#阻塞和非阻塞网络模型#xff1a;
#同步阻塞模型#xff0c;一请… # nginx不同于apache服务器当进行了大量优化设置后会魔术般的明显性能提升效果
# nginx在安装完成后大部分参数就已经是最优化了我们需要管理的东西并不多#user nobody;#阻塞和非阻塞网络模型
#同步阻塞模型一请求一进线程当进线程增加到一定程度后
#更多CPU时间浪费到切换一性能急剧下降所以负载率不高
#Nginx基于事件的非阻塞多路复用(epoll或kquene)模型
#一个进程在短时间内可以响应大量的请求
#建议值 cpu核心数量一般高于cpu数量不会带好处也许还有进程切换开销的负面影响
worker_processes 4;#将work process绑定到特定cpu上避免进程在cpu间切换的开销
worker_cpu_affinity 0001 0010 0100 1000
#4内核4进程时的设置方法
#8内核4进程时的设置方法 worker_cpu_affinity 00000001 00000010 00000100 10000000# 每进程最大可打开文件描述符数量(linux上文件描述符比较广义网络端口、设备、磁盘文件都是)
# 文件描述符用完了新的连接会被拒绝产生502类错误
# linux最大可打开文件数可通过ulimit -n FILECNT或 /etc/security/limits.conf配置
# 理论值 系统最大数量 / 进程数。但进程间工作量并不是平均分配的所以可以设置的大一些
worker_rlimit_nofile 655350 #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;events {# 并发响应能力的关键配置值# 每个进程允许的最大同时连接数work_connectins * worker_processes maxConnection;# 要注意maxConnections不等同于可响应的用户数量# 因为一般一个浏览器会同时开两条连接如果反向代理nginx到后端服务器的连接也要占用连接数# 所以做静态服务器时一般 maxClient work_connectins * worker_processes / 2# 做反向代理服务器时 maxClient work_connectins * worker_processes / 4# 这个值理论上越大越好但最多可承受多少请求与配件和网络相关,也可最大可打开文件最大可用sockets数量约64K有关worker_connections 500;# 指明使用epoll 或 kquene (*BSD)use epoll# 备注要达到超高负载下最好的网络响应能力还有必要优化与网络相关的linux内核参数
}http {include mime.types;default_type application/octet-stream;#log_format main $remote_addr - $remote_user [$time_local] $request # $status $body_bytes_sent $http_referer # $http_user_agent $http_x_forwarded_for;# 关闭此项可减少IO开销但也无法记录访问信息不利用业务分析一般运维情况不建议使用access_log off# 只记录更为严重的错误日志可减少IO压力error_log logs/error.log crit;#access_log logs/access.log main;# 启用内核复制模式应该保持开启达到最快IO效率sendfile on;# 简单说启动如下两项配置会在数据包达到一定大小后再发送数据# 这样会减少网络通信次数降低阻塞概率但也会影响响应及时性# 比较适合于文件下载这类的大数据包通信场景#tcp_nopush on; 在 #tcp_nodelay on|off on禁用Nagle算法 #keepalive_timeout 0;# HTTP1.1支持持久连接alive# 降低每个连接的alive时间可在一定程度上提高可响应连接数量所以一般可适当降低此值keepalive_timeout 30s;# 启动内容压缩有效降低网络流量gzip on; # 过短的内容压缩效果不佳压缩过程还会浪费系统资源gzip_min_length 1000;# 可选值1~9,压缩级别越高压缩率越高但对系统性能要求越高gzip_comp_level 4;# 压缩的内容类别gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xmlrss text/javascript;# 静态文件缓存# 最大缓存数量文件未使用存活期open_file_cache max655350 inactive20s;# 验证缓存有效期时间间隔open_file_cache_valid 30s;# 有效期内文件最少使用次数open_file_cache_min_uses 2;server {listen 80;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;location / {root html;index index.html index.htm;}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location /50x.html {root html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {# proxy_pass http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {# root html;# fastcgi_pass 127.0.0.1:9000;# fastcgi_index index.php;# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;# include fastcgi_params;#}# deny access to .htaccess files, if Apaches document root# concurs with nginxs one##location ~ /\.ht {# deny all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {# listen 8000;# listen somename:8080;# server_name somename alias another.alias;# location / {# root html;# index index.html index.htm;# }#}# HTTPS server##server {# listen 443 ssl;# server_name localhost;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_cache shared:SSL:1m;# ssl_session_timeout 5m;# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}}转载于:https://www.cnblogs.com/zyw-205520/p/5078003.html