nginx优化配置说明
来源:互联网 发布:linux tomcat配置 编辑:程序博客网 时间:2024/06/05 11:52
nginx 是一个高性能的http和反向代理 服务器,也是一个imap/pop3/smtp代理服务器
user ben woyoudever;#工作进程使用的用户和组worker_processes 10;#打开的工作进程数,应该是cpu的个数worker_rlimit_nofile 10240;#指定一个进程最多打开的文件数最好与ulimit -n 保持一致#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#错误日志以及错误等级 [debug|info|notice|warn|error|crit]pid logs/nginx.pid;#nginx主进程的pid数events { #use [kqueue|rtsig|epoll|poll|select] use epoll;#使用epoll网络 I/O模型 worker_connections 65535;#单个进程的最大连接数}http { include mime.types;#文件扩展名和文件类型映射表 default_type application/octet-stream;#默认文件格式 charset gb2312,utf-8;#默认编码 server_names_hash_bucket_size 128;#服务器名称的hash表大小 #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; client_header_buffer_size 4K;#客户端头的缓冲区大小 open_file_cache max=10240 inactive=20s;#打开文件的缓冲 open_file_cache_valid 30s;#多久时间检查一下缓存的有效信息 open_file_cache_min_uses1;#最少使用次数 sendfile on;#开启高效网络传输 tcp_nopush on; #防止网络阻塞 tcp_nodelay on; #keepalive_timeout 0; keepalive_timeout 65;#keepalive超时时间 gzip on;#是否开启压缩模块,要用到cpu zip_min_length 1k;#最小压缩文件大小 gzip_buffers 4 16k; #压缩缓冲区 gzip_http_version 1.0;#压缩版本 gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml;#压缩的类型 gzip_vary on; client_max_body_size 8m; #上传文件大小限制 fastcgi_connect_timeout 300;#fastcgi连接超时时间 fastcgi_send_timeout 300;#发送超时时间 fastcgi_read_timeout 300;#读取超时时间 fastcgi_buffer_size 64k;#缓冲区大小 fastcgi_buffers 4 64k;#设置多大的缓冲区缓冲 fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; fastcgi_cache TEST;#开启fastcgi缓存 fastcgi_cache_valid 200 302 1h;#200 302应答一个小是 fastcgi_cache_valid 301 1d; fastcgi_cache_valid any 1m; fastcgi_cache_min_uses 1; upstream backend_server {#后端负载 #server 192.168.10.22:80 weight=1 max_fails=2 fail_timeout=30s; server 192.168.10.27:80 weight=1 max_fails=2 fail_timeout=30s; #server 192.168.10.20:80 weight=1 max_fails=2 fail_timeout=30s; } server { listen 808; 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 Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #}#查看nginx状态要添加 --with-http_stub_status_module模块location /nginxstatus{sub_status on;access_log on;} } # 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; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #}}
- nginx优化配置说明
- nginx优化配置说明
- Nginx配置详情-配置说明-参数优化(一)
- nginx.conf的完整配置说明 及 优化
- 【Nginx】Nginx配置优化
- Nginx优化配置优化
- Nginx配置详情-配置说明-参数优化-Nginx反向代理、负载均衡(四)
- nginx nginx.conf配置说明
- nginx详细配置说明
- Nginx完整配置说明
- nginx详细配置说明
- nginx 配置说明 [WebServer]
- Nginx完整配置说明
- nginx配置详细说明
- Nginx配置文档说明
- Nginx 配置说明
- Nginx完整配置说明
- nginx配置详细说明
- linux内核的container_of()宏定义分析
- nginx正则
- 数据库操作之复制表结构方法
- Java中toArray的用法探究(java数组与list转换)
- 第三方应用&框架搜集
- nginx优化配置说明
- 选择排序
- XXX
- Linux 快速删除大量小文件方法
- Oracle 表连接方式(内连接/外连接/自连接) 详解
- linux设置RTC
- Android开发五大布局及其属性整合
- THML5的重要标记
- winec7初体验