NGINX-新浪博客配置

user  www www;

worker_processes 10;

error_log  /data1/logs/nginx_error.log  crit;

pid        /tmp/nginx.pid;

worker_rlimit_nofile 51200;

events 
{
      use epoll;

      worker_connections 51200;
}

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

      charset  gb2312;
       
      server_names_hash_bucket_size 128;

      keepalive_timeout 15;

      sendfile on;
      tcp_nopush on;
      tcp_nodelay on;

      #第1组接口机:Memcache相关(点击数)
      upstream  count.interface.video.sina.com.cn  {
              server   xx.xx.xx.55:80;
              server   xx.xx.xx.58:80;
              server   xx.xx.xx.47:80;
      }

      #第2组接口机:外部提供数据类程序
      upstream  data.interface.video.sina.com.cn  {
              server   xx.xx.xx.59:80;
              server   xx.xx.xx.64:80;
              server   xx.xx.xx.48:80;
      }

      #第3组接口机:打日志类程序、功能相关、嵌套页面
      upstream  log.interface.video.sina.com.cn  {
              server   xx.xx.xx.72:80;
              server   xx.xx.xx.49:80;
      }

      server
      {
              listen  80;
              server_name interface.video.sina.com.cn;

              location / {
                       proxy_redirect off;

                       #后端的Web服务器可以通过X-Forwarded-For获取用户真实IP
                       proxy_set_header   X-Forwarded-For  $remote_addr;

                       #按URL进行分组,第1组:Memcache相关(点击数)
                       if ($request_uri ~ "^\/app\/count\/")
                       {
                               proxy_pass http://count.interface.video.sina.com.cn;    
                       }
                       if ($request_uri ~ "^\/app\/online\/")
                       {
                               proxy_pass http://count.interface.video.sina.com.cn;    
                       }
                       if ($request_uri ~ "^\/interface\/user\/getLoginGap.php")
                       {
                               proxy_pass http://count.interface.video.sina.com.cn;    
                       }

                       #按URL进行分组,第2组:外部提供数据类程序
                       if ($request_uri ~ "^\/crossdomain.xml")
                       {
                               proxy_pass http://data.interface.video.sina.com.cn;    
                       }
                       if ($request_uri ~ "\/interface\/client\/topVideoClient.php")
                       {
                               proxy_pass http://data.interface.video.sina.com.cn;    
                       }
                       if ($request_uri ~ "^\/interface\/common\/")
                       {
                               proxy_pass http://data.interface.video.
                                     sina.com.cn;    
                       }
                       if ($request_uri ~ "^\/interface\/randplay\/randplay. 
                             php")
                       {
                               proxy_pass http://data.interface.video. 
                                     sina.com.cn;    
                       }
                       if ($request_uri ~ "^\/interface\/topic\/suggTopic.php")
                       {
                               proxy_pass http://data.interface.video.sina. 
                                     com.cn;    
                       }
                       if ($request_uri ~ "^\/interface\/uploadClient\/")
                       {
                               proxy_pass http://data.interface.video. 
                                     sina.com.cn;    
                       }
                       if ($request_uri ~ "^\/interface\/xml\/")
                       {
                               proxy_pass http://data.interface.video. 
                                     sina.com.cn;    
                       }
                       if ($request_uri ~ "^\/outinterface\/")
                       {
                               proxy_pass http://data.interface.video.sina. 
                                     com.cn;    
                       }

                       #按URL进行分组,第3组:打日志类程序
                       if ($request_uri ~ "^\/interface\/flash\/")
                       {
                               proxy_pass http://log.interface.video.sina. 
                                     com.cn;    
                       }
                       if ($request_uri ~ "^\/interface\/playrank\/
                                     playrank2008_10.php")
                       {
                               proxy_pass http://log.interface.video.sina. 
                                     com.cn;    
                       }

                       #按URL进行分组,其他组:功能相关、嵌套页面等未匹配到的URL
                       proxy_pass        http://log.interface.video. 
                                     sina.com.cn;
              }

              #定义日志格式
              log_format  count  '$remote_addr - $remote_user [$time_local] 
                    $request '
                                '"$status" $body_bytes_sent "$http_referer" '
                                '"$http_user_agent" "$http_x_forwarded_for"';
              #打日志
              access_log  /data1/logs/interface.log  count;

              #允许客户端请求的最大的单个文件字节数
              client_max_body_size     10m;

              #缓冲区代理缓冲用户端请求的最大字节数 可以理解为先保存到本地再传给用户
              client_body_buffer_size  128k;
              
              #跟后端服务器连接的超时时间_发起握手等候响应超时时间
              proxy_connect_timeout    600;
                      
              #连接成功后_等候后端服务器响应时间_其实已经进入后端的排队等候处理
              proxy_read_timeout       600;
              
              #后端服务器数据回传时间_就是在规定时间之内后端服务器必须传完所有的数据
              proxy_send_timeout       600;
              
              #代理请求缓存区_这个缓存区间会保存用户的头信息以供Nginx进行规则处理_一般只要能保存下头信息即可
              proxy_buffer_size        8k;
              
              #同上 告诉Nginx保存单个用的几个Buffer 最大用多大空间
              proxy_buffers            4 32k;
              
              #如果系统很忙的时候可以申请更大的proxy_buffers 官方推荐*2    
              proxy_busy_buffers_size 64k;
              
              #proxy缓存临时文件的大小
              proxy_temp_file_write_size 64k;
      }
}

 

 

 NGINX新浪博客配置

你可能感兴趣的:(PHP,nginx,xml,Flash,Access)