Chinaunix首页 | 论坛 | 博客
  • 博客访问: 178721
  • 博文数量: 29
  • 博客积分: 2115
  • 博客等级: 大尉
  • 技术积分: 320
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-01 18:15
文章分类

全部博文(29)

文章存档

2013年(1)

2012年(1)

2011年(5)

2010年(18)

2009年(1)

2008年(3)

我的朋友

分类: LINUX

2010-02-26 21:34:08

vhost/status.conf:
 
server {
        listen 80 default deferred; # 默认的server
        server_name _; # 只接受IP访问
        access_log /var/log/nginx/status_access.log;
        location /nginx_status {
        stub_status on; # 打开status监控
        access_log off;
        allow 127.0.0.1;
        deny all;
        }
}
 
nginx.conf:
 
user                 fcgi;
worker_processes     4; # nginx进程数
worker_cpu_affinity  0001 0010 0100 1000; #进程所使用的cpu号 
worker_rlimit_nofile 65535; # 进程所打开的句柄数
events {
    use epoll; 
    worker_connections  10240;
}
http {
    server_tokens     off; # 当nginx出现错误页面时不显示版本号
    gzip              on;
    gzip_types        text/xml text/css application/x-javascript;
    gzip_min_length   1000;
    gzip_vary         on;  #让Nginx前端的Squid 2.5/2.6缓存服务器能够缓存经过gzip压缩的页面。
    gzip_comp_level   9;
 
    ...
 
}
 
#打开cache
http{} 里加入:
proxy_cache_path /opt/nginx/proxy_temp levels=1:2 keys_zone=CNAME:30m max_size=2m ;
        location /app{
             access_log  /var/log/nginx/access_cache.log  cache;
             proxy_cache_key  $host$request_uri;
             proxy_pass ;
             proxy_cache CNAME;
             proxy_cache_valid 200 301 302 10m;
        }
参考

 
阅读(1051) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~