免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5699 | 回复: 3
打印 上一主题 下一主题

[其他] nginx无法生成缓存 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-12-26 17:17 |只看该作者 |倒序浏览
user  www www;
worker_processes 2;
error_log  /var/log/nginx_error.log  crit;
worker_rlimit_nofile 65535;
events
{
  use epoll;
  worker_connections 65535;
}

http
{
  include       mime.types;
  default_type  application/octet-stream;

  server_names_hash_bucket_size 128;
  client_header_buffer_size 32k;
  large_client_header_buffers 4 32k;
  client_max_body_size 100m;

  sendfile on;
  tcp_nopush     on;
  keepalive_timeout 65s;
  #tcp_nodelay on;

  fastcgi_connect_timeout 300;
  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;
  #cache##
  #proxy_store on;
  proxy_connect_timeout 5;
  proxy_read_timeout 60;
  proxy_send_timeout 5;
  proxy_buffer_size 16k;
  proxy_buffers 4 64k;
  proxy_busy_buffers_size 128k;
  proxy_temp_file_write_size 128k;
  #proxy_store on;
  #proxy_store_access user:rw group:rw all:rw;
  proxy_temp_path /home/temp_dir;
  proxy_cache_path /home/cache levels=1:2 keys_zone=cache_pander:200m inactive=1d max_size=3g;
  ##end##

  #gzip    on;
  #gzip_min_length   1k;
  #gzip_buffers   4 8k;
  #gzip_http_version  1.1;
  #gzip_types   text/plain application/x-javascript text/css  application/xml;
  #gzip_disable "MSIE [1-6]\.";  

  log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
  upstream appserver {
        server 192.168.7.35:1935 weight=1 max_fails=2 fail_timeout=30s;
  }
  server {
        listen       80;
        server_name 192.168.6.221;
        location ~ .*\.(m3u8|ts|gif|jpg|png|htm|html|css|js|flv|ico|swf)(.*) {
              proxy_pass http://appserver;
                          proxy_redirect off;
              proxy_set_header Host $host;
              proxy_cache cache_pander;
              proxy_cache_valid 200 304 302 24h;
              proxy_cache_valid 301 1d;
              proxy_cache_valid any 1m;
                          
              expires 30d;
        }
        location ~ .*\.(php)(.*){
             proxy_pass http://appserver;
             proxy_set_header        Host $host;
             proxy_set_header        X-Real-IP $remote_addr;
             proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        access_log /usr/local/nginx/logs/www.gangpao.com.log;
  }
}

论坛徽章:
4
戌狗
日期:2014-10-12 21:48:202015年辞旧岁徽章
日期:2015-03-03 16:54:15IT运维版块每日发帖之星
日期:2015-06-09 22:20:002016猴年福章徽章
日期:2016-02-18 15:30:34
2 [报告]
发表于 2014-01-07 21:32 |只看该作者
缓存目录不对,不要建立到home目录下。在其他目录建立个,所有者为www,或者保证www用户可写

论坛徽章:
6
丑牛
日期:2013-09-17 00:18:40未羊
日期:2013-10-31 12:10:47午马
日期:2013-12-07 01:58:50水瓶座
日期:2013-12-24 22:43:12水瓶座
日期:2014-03-15 21:12:13操作系统版块每日发帖之星
日期:2016-08-07 06:20:00
3 [报告]
发表于 2014-01-08 20:59 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
4 [报告]
发表于 2014-01-09 14:09 |只看该作者
thankyou  版主 已解决回复 3# yuhongchun


   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP