• nagios的监控代码!


    user  www www;
    
    worker_processes 8;
    
    error_log   logs/nginx_error.log  crit;
    
    pid        logs/nginx.pid;
    
    #Specifies the value for maximum file descriptors that can be opened by this process. 
    worker_rlimit_nofile 51200;
    
    events 
    {
        use epoll;
    
        worker_connections 51200;
    }
    
    http 
    {
        include       mime.types;
        default_type  application/octet-stream;
    
        #charset  gb2312;
          
        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
            client_max_body_size 8m;
          
        sendfile on;
        tcp_nopush     on;
    
        keepalive_timeout 60;
    
        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;
        fastcgi_intercept_errors on;
    
        gzip on;
        gzip_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;
    
        #limit_zone  crawler  $binary_remote_addr  10m;
        
        upstream py.domain.com {
            server   192.168.113.210:80;
        }     
         
        server
        {
            listen       80;
            server_name  domain.com *.domain.com 59.151.101.* 192.168.113.* web1 web3 web4 web5 web6 localhost;
            index index.php index.htm index.html;
            root  /server/www/domain;
    
            #limit_conn   crawler  20;
    
            add_header Load-Balancing $server_addr;
    
            error_page 404 /_script/error404.php;
    
            #�ض���������վ�ĵ��������������ˣ���Ҫ�޸�             
            if ($host ~* ^(.*?).domain.com$)
            {
                set $var_anti_daolian '1';
            }             
            if ($host ~* ^59.151.101.(.*?)$)
            {
                set $var_anti_daolian '1';
            }
            if ($host ~* ^192.168.113.(.*?)$)
            {
                set $var_anti_daolian '1';
            }
            if ($host ~* ^web(.*?))
            {
                set $var_anti_daolian '1';
            }
            if ($host ~* ^localhost)
            {
                set $var_anti_daolian '1';
            }    
            if ($var_anti_daolian !~ '1')
            {
                rewrite ^/(.*)$ http://www.domain.com/ redirect;
            }
    
            #������ѯ
            rewrite ^/bus/xianlu_(.*) /bus/bus_xl.php?q_xl=$1 last;
            rewrite ^/bus/zhandian_(.*)/(.*) /bus/bus_st.php?q_st=$1&p=$2 last;
            rewrite ^/bus/zhandian_(.*) /bus/bus_st.php?q_st=$1 last;
            rewrite ^/bus/k_(.*)_(.*)_(.*) /bus/bus_tr.php?saddr=$1&daddr=$2&sort=$3 last;
            rewrite ^/bus/k_(.*)_(.*) /bus/bus_tr.php?saddr=$1&daddr=$2 last;
            rewrite ^/bus/list_xl/(.*) /bus/bus_list.php?sort=xl&key=$1 last;
            rewrite ^/bus/list_st/(.*) /bus/bus_list.php?sort=st&key=$1 last;
            rewrite ^/bus/index.php /bus/bus_city.php last;
            rewrite ^/bus/$ /bus/bus_city.php last;
            if ($host ~* ^bus.domain.com$)
            {
                    rewrite ^/$ /bus/index.php last;
            }
    
            #С����ʾ
            location /xiaoqu/_fastcode/
            {
                proxy_pass http://py.domain.com/;
            }
    
            #����֧�����˹�������Zend Framework����
            if ($request_uri ~* "^/pay(.*)")
            {
                set $var_pay_public '1';
            }
            if ($request_uri ~* ".*.(js|ico|gif|jpg|png|css)$")
            {
                set $var_pay_public '0';
            }
            if ($var_pay_public ~ '1')
            {
                rewrite ^(.*)$ /pay/index.php last;
            }    
            
            if ($host ~* ^www(.*?) )
            {
                    rewrite  ^/xiaoqu(.*)$ /xiaoqu_2_404/;
            }
            location /xiaoqu_2_404/ {
                    return 404;
            }
            
            #�����°����ⷿ�б�ҳ����ϸҳ
            if ($host ~* ^(bj|sh|simulation1).domain.com$)
            {
                    #���ַ������ⷿlandmark301��ת
                    rewrite ^/fang(1|5)/landmark_([^_]+)_(d+).htm$  /domain_v2/seo/house/fix_landmark.php?text=$2&area=$3&list_type=$1 last;
    
                    #�������ⷿ
                    rewrite ^/fang1/d+_(d+).htm$  /domain_v2/apps/house/rent/rent_detail.php?id=$1 last;
                    rewrite ^/fang1/$  /domain_v2/apps/house/rent/rent_list.php?simple_filter= last;
                    rewrite ^/fang1/(d+)/$  /domain_v2/apps/house/rent/rent_list.php?agent=$1 last;
                    rewrite ^/fang1/(d+)+.htm$  /domain_v2/apps/house/rent/rent_list.php?simple_filter=$1 last;
                    rewrite ^/fang1/(d+)/(d+).htm$  /domain_v2/apps/house/rent/rent_list.php?simple_filter=$2&agent=$1 last;
                    rewrite ^/fang1/(d+)/(.*)$  /domain_v2/apps/house/rent/rent_list.php?filter=$2&agent=$1&$query_string last;
                    rewrite ^/fang1/(.*)$  /domain_v2/apps/house/rent/rent_list.php?filter=$1&$query_string last;
    
                    #�������ַ�
                    rewrite ^/fang5/d+_(d+).htm$  /domain_v2/apps/house/sell/sell_detail.php?id=$1 last;
                    rewrite ^/fang5/$  /domain_v2/apps/house/sell/sell_list.php?simple_filter= last;
                    rewrite ^/fang5/(d+)/$  /domain_v2/apps/house/sell/sell_list.php?agent=$1 last;
                    rewrite ^/fang5/(d+)+.htm$ /domain_v2/apps/house/sell/sell_list.php?simple_filter=$1 last;
                    rewrite ^/fang5/(d+)/(d+).htm$  /domain_v2/apps/house/sell/sell_list.php?simple_filter=$2&agent=$1 last;
                    rewrite ^/fang5/(d+)/(.*)$  /domain_v2/apps/house/sell/sell_list.php?filter=$2&agent=$1&$query_string last;
                    rewrite ^/fang5/(.*)$  /domain_v2/apps/house/sell/sell_list.php?filter=$1&$query_string last;
    
                    #������
                    rewrite ^/xiaoqu/([a-z0-9]+)/chuzufang/(d)/(.*)$ /xiaoqu/chuzufang.php?name=$1&agent=$2&filter=$3 last;
                    rewrite ^/xiaoqu/([a-z0-9]+)/chuzufang/(.*)$ /xiaoqu/chuzufang.php?name=$1&filter=$2 last;
                    rewrite ^/xiaoqu/([a-z0-9]+)/ershoufang/(d)/(.*)$  /xiaoqu/ershoufang.php?name=$1&agent=$2&filter=$3 last;
                    rewrite ^/xiaoqu/([a-z0-9]+)/ershoufang/(.*)$  /xiaoqu/ershoufang.php?name=$1&filter=$2 last;        
            }
            if ($host ~* ^(bj|simulation1).domain.com$)
            {
                    rewrite ^/fang(3)/landmark_([^_]+)_(d+).htm$  /domain_v2/seo/house/fix_landmark.php?text=$2&area=$3&list_type=$1 last;
                    rewrite ^/fang3/d+_(d+).htm$  /domain_v2/apps/house/share/share_detail.php?id=$1 last;
                    rewrite ^/fang3/$  /domain_v2/apps/house/share/share_list.php?simple_filter= last;
                    rewrite ^/fang3/(d+)/$  /domain_v2/apps/house/share/share_list.php?agent=$1 last;
                    rewrite ^/fang3/(d+)+.htm$  /domain_v2/apps/house/share/share_list.php?simple_filter=$1 last;
                    rewrite ^/fang3/(d+)/(d+).htm$  /domain_v2/apps/house/share/share_list.php?simple_filter=$2&agent=$1 last;
                    rewrite ^/fang3/(d+)/(.*)$  /domain_v2/apps/house/share/share_list.php?filter=$2&agent=$1&$query_string last;
                    rewrite ^/fang3/(.*)$  /domain_v2/apps/house/share/share_list.php?filter=$1&$query_string last;
            }
    
            #���ַ������ⷿlandmark301��ת
            rewrite ^/fang([0-9]*)/landmark_([^_]+)_(d+).htm$  /info/info_list.php?land=search&sortList=fang$1&landmark=$2 last;
            rewrite ^/fang([0-9]*)/bus0station_(d+)_(d+).htm$  /info/info_list.php?land=search&sortList=fang$1&bus_station=$2  last;
            rewrite ^/fang([0-9]*)/sub0way_(d+)_(d+).htm$  /info/info_list.php?land=search&sortList=fang$1&sub_way=$2 last;
    
            #С����̬����
            rewrite ^/xiaoqu(/css/.*)$  /xiaoqu/static$1 last;
            rewrite ^/xiaoqu(/image/.*)$  /xiaoqu/static$1 last;
            rewrite ^/xiaoqu(/js/.*)$  /xiaoqu/static$1 last;
            
            #С������ҳ����ͼ��JS��С����ʾ��ʹ��rewrite
            rewrite ^/xiaoqu/ditu/$ /xiaoqu/ditu/index.php last;
            rewrite ^/xiaoqu/ditu$ http://$host/xiaoqu/ditu/ permanent;
            if ($request_uri ~* "^/xiaoqu/admin/.*")
            {
                set $var_xiaoqu_admin '1';
            }
            if ($request_uri ~* "^/xiaoqu/swftool/.*")
            {
                    set $var_xiaoqu_admin '1';
            }
            if ($request_uri ~* "^/xiaoqu/map/.*")
            {
                set $var_xiaoqu_admin '1';
            }
            if ($request_uri ~* "^/xiaoqu/accounts/.*")
            {
                set $var_xiaoqu_admin '1';
            }
            if ($request_uri ~* "^/xiaoqu/ajax/.*")
            {
                set $var_xiaoqu_admin '1';
            }
            if ($request_uri ~* "^/xiaoqu/_fastcode/.*")
            {
                set $var_xiaoqu_admin '1';
            }
            if ($request_uri ~* "^/xiaoqu/ditu/.*")
            {
                    set $var_xiaoqu_admin '1';
            }
            if ($request_uri ~* "^/xiaoqu/$")
            {
                set $var_xiaoqu_admin '1';
            }        
            if ($var_xiaoqu_admin !~ '1')
            {
                rewrite ^/xiaoqu/(.*?)/(.*?)/$ /xiaoqu/$2.php?name=$1 last;
                rewrite ^/xiaoqu/$  /xiaoqu/index.php last;
                rewrite ^/xiaoqu/(.+?)/ /xiaoqu/detail.php?name=$1 last;
                rewrite ^/xiaoqu/(d+)+.htm$  /xiaoqu/index.php?simple_filter=$1 last;
                rewrite ^/xiaoqu/(.*)$  /xiaoqu/index.php?filter=$1&$query_string last;
            }
            
            #���⹦��������������    
            if ($request_uri ~* "^/(chunyun|gongzuozongjie|jianli|zhaopinhui|laodonghetong|aoyun|lieche|ztchongwu)(.*)")
            {
                set $var_domain_acl_a '1';
            }
            if ($host ~* ^www.domain.com$)
            {
                set $var_domain_acl_a '0';
            }        
            if ($var_domain_acl_a ~ '1')
            {
                rewrite ^(.*)$ http://www.domain.com$1 redirect;
            }
            
            if ($request_uri ~* "^/tour(.*)")
            {
                set $var_domain_acl_b '1';
            }
            if ($host ~* ^bj.domain.com$)
            {
                set $var_domain_acl_b '0';
            }        
            if ($var_domain_acl_b ~ '1')
            {
                rewrite ^(.*)$ http://bj.domain.com$1 redirect;
            }
    
            #������"/"
            rewrite ^/([a-zA-Z0-9]+)$ http://$host/$1/ permanent;
            
            #�����ת����̳��301��ת��
            if ($host ~* ^bj.domain.com$)
            {
                    rewrite ^/huodong([0-9]*)/$  http://club.domain.com/forumdisplayevent.php?fid=69&typeid=$1 permanent;
                    rewrite ^/huodong([0-9]*)/_(.*)$  http://club.domain.com/forumdisplayevent.php?fid=69&typeid=$1 permanent;
            }
            
            #��վ����ҳ�������ƹ�����������Ƹ��ְ��ְȫ��ҳ
            if ($host ~* ^www.domain.com$)
            {
                rewrite ^/zhaoshang.htm$ http://tuiguang.domain.com/zhaoshang/index.htm permanent;
                rewrite ^/(jianzhi|zhaopin|qiuzhi)/$ /html/tags/zp$1/index.htm permanent;
            }
    
            #���ɹ�����ת
            rewrite ^/netbar/([a-zA-Z]+)/$ /html/wangba/$1/index.htm last;
            
            #��Ʒ���׳���ҳ
            if ($host ~* ^(.*?).domain.com$)
            {
                set $var_wupin_city $1;
                set $var_wupin '1';
            }
            if ($host ~* ^qita.domain.com$)
            {
                set $var_wupin '0';
            }        
            if (!-f $document_root/html/zhuanti/secondmarket/$var_wupin_city/ index.htm)
            {
                set $var_wupin '0';
            }
            if ($var_wupin ~ '1')
            {
                rewrite ^/wu/$ /html/zhuanti/secondmarket/$var_wupin_city/index.
    htm last;
            }
            
            #����wu1��ת��diannao
            if ($host ~* ^bj.domain.com$)
            {
                rewrite ^/wu1/$ http://bj.domain.com/diannao/ permanent;
            }
    
            #������Ƹ��ҳ
            if ($host ~* ^(.*?).domain.com$)
            {
                set $var_city_wanted_city $1;
                set $var_city_wanted '1';
            }
            if ($host ~* ^qita.domain.com$)
            {
                set $var_city_wanted '0';
            }        
            if (!-f $document_root/html/zhuanti/city_wanted/$var_city_wanted_city/ index.htm)
            {
                set $var_city_wanted '0';
            }
            if ($var_city_wanted ~ '1')
            {
                rewrite ^/zhaopin/$ /html/zhuanti/city_wanted/$var_city_wanted_city/ index.htm last;
            }        
    
            #������ְ��ҳ
            if ($host ~* ^(.*?).domain.com$)
            {
                set $var_city_findjob_city $1;
                set $var_city_findjob '1';
            }
            if ($host ~* ^qita.domain.com$)
            {
                set $var_city_findjob '0';
            }        
            if (!-f $document_root/html/zhuanti/city_findjob/$var_city_findjob_city/ index.htm)
            {
                set $var_city_findjob '0';
            }
            if ($var_city_findjob ~ '1')
            {
                rewrite ^/qiuzhi/$ /html/zhuanti/city_findjob/$var_city_findjob_city/
    index.htm last;
            }
    
            #������ҳ���������ѷ�����Ϣ,ע��,��¼α��̬
            rewrite ^/aboutus2/help/$ /aboutus2/aboutusnew.php?act=helpNew last;
            rewrite ^/post/$ /post/type_select.php last;
            rewrite ^/common/reg/$ /common/reg.php last;
            rewrite ^/([a-z]+)/user/login/$ /user/login.php?login=1&forward= http://$host/$1/ last;
            rewrite ^/user/login/$ /user/login.php?login=1&forward=http://$host last;
    
            #tagȫ��ҳ
            if ($host ~* ^www.domain.com$)
            {
                set $var_tagindex '1';
            }
            if (!-f $document_root/html/secondmarketindex/tagindex/$request_uri/ index.htm)
            {
                set $var_tagindex '0';
            }
            if ($var_tagindex ~ '1')
            {
                rewrite ^/([a-zA-Z0-9]+)/$ /html/secondmarketindex/tagindex/$1/
    index.htm last;
                rewrite ^/html/secondmarketindex/tagindex/([a-zA-Z]+)/.*$ 
    http://$host/$1/ redirect;
            }        
    
            #��ְ����ҳ
            if ($host ~* ^(.*?).domain.com$)
            {
                set $var_jianzhi_city $1;
                set $var_jianzhi '1';
            }
            if ($host ~* ^www.domain.com$)
            {
                set $var_jianzhi '0';
            }
            if ($var_jianzhi ~ '1')
            {
                rewrite ^/jianzhi/$ /html/zhuanti/jianzhi/${var_jianzhi_city}
    _zp.htm last;
                rewrite ^/jianzhi1/$ /html/zhuanti/jianzhi/${var_jianzhi_city}
    _qz.htm last;
            }
    
            #��ְȫ��ҳ�ϵ��б�ҳ����
            rewrite ^/zhoumojianzhi/$ /info/info_list.php?act=search&sort=wanted&list_type=13&district=-1&streetid=
    -1&attr4=��ĩ��ְ last;
            rewrite ^/xueshengjianzhi/$ /info/info_list.php?act=search&sort=wanted&list_type=13&district=-1&streetid=
    -1&attr5=ѧ����ְ last;
            
            #��������ҳ
            rewrite ^/(mianshi|xianjing)/$ /zl/index.php?name=$1 last;
            rewrite ^/ceshi/$ /zl/ceshi.php last;
            rewrite ^/(mianshi)_([a-zA-Z]+)/$ /zl/index.php?name=$1_$2 last;
            rewrite ^/pingce([0-9]*)/$ /zl/pingce.php?id=$1 last;
    
            #����Ʊ
            rewrite ^/huochepiao/([a-zA-Z]+)_lingshou.htm$  /tpl/huochepiao/$1_ lingshou.htm  last;
            rewrite ^/huochepiao/info_([0-9]+).htm$ /piao/huoche_info.php?infoId=$1 last;
            if ($host ~* ^www.domain.com$)
            {
                    rewrite ^/huochepiao/$  /html/zhuanti/huochepiao_new/index.htm last;
                    rewrite ^/piao/$ /html/zhuanti/huochepiao/www_index.htm last;
            }
            if ($host ~* ^(.*?).domain.com$)
            {
                set $var_piao_city $1;
                rewrite ^/piao/$ /html/zhuanti/huochepiao/${var_piao_city}_index.htm last;
                rewrite ^/piao/zhuanrang/$ /info/info_list.php?act=search&sort=
    secondmarket&list_type=18&district=-1&streetid=-1&dealType=-1 last;
                rewrite ^/piao/qiugou/$ /info/info_list.php?act=search&sort=
    secondmarket&list_type=18&district=-1&streetid=-1&dealType=1 last;
                rewrite ^/piao/cc_(.+)/$ /info/info_list.php?act=search&sort=
    secondmarket&list_type=18&district=-1&streetid=-1&trainNo=$1 last;
                rewrite ^/piao/cz_(.*?)_(.*?)/$ /info/info_list.php?act=search&sort=
    secondmarket&list_type=18&district=-1&streetid=-1&sStation=$1&eStation=$2 last;
                rewrite ^/piao/info_([0-9]+).htm$ /piao/huoche_info.php?infoId=$1 last;
            }
            
            #�г�ʱ�̱�
            rewrite ^/lieche/chezhan/(.*?)/$ /piao/trainQuery2.php?txtChezhan=$1 last;
            rewrite ^/lieche/checi/(.*?)/$ /piao/trainQuery2.php?trainNo=$1 last;
            rewrite ^/lieche/luxian/(.*?)-(.*?)/$ /piao/trainQuery2.php?txtChuFa=
    $1&txtDaoDa=$2 last;
            rewrite ^/lieche/piaojia/(.*?)-(.*?)/$ /piao/pj.php?trainNopj=$1&no=$2 last;
            rewrite ^/lieche/piaojia/(.*?)/$ /piao/pj.php?trainNopj=$1 last;
            
            #����
            rewrite ^/tour/message/(.*?).htm$  /tour/ permanent;
            rewrite ^/tour/(.*?)(news|zhinan|canyin|zhusu|jiaotong)/(d+).htm$  /html/zhuanti/lvyou/message/$3.htm last;
            if ($request_uri ~* ^/tour/(.*).php)
            {
                set $var_tour '1';
            }
            if ($request_uri ~* ^/tour/bjdaoyouci/.*)
            {
                set $var_tour '1';
            }
            if ($var_tour !~ '1')
            {
                rewrite ^/tour/(.*)  /html/zhuanti/lvyou/$1 last;
            }
    
            #���ű�ǩ֮����Ʊ
            rewrite ^/piao/piao-list/(d+).htm$ /_script/dede_hot/piao_list.php?page=$1 last;
            rewrite ^/piao/piao-list/d(d+).htm$ /_script/dede_hot/piao_detail.php?id=$1 last;
            
            #www�����ű�ǩ��ץȡ��Ϣ
            if ($host ~* ^www.domain.com$)
            {
                rewrite ^/([a-zA-Z0-9]+?)/[^-]+-list/(d+).htm$ /_script/dede_hot/hotwords_list.php?sort=$1&page=$2 last;
                rewrite ^/([a-zA-Z0-9]+?)/[^-]+-list/d(d+).htm$ /_script/dede_hot/hotwords_detail.php?sort=$1&id=$2 last;
            }        
            
            #��������
            rewrite ^/aboutus/About.html$ /aboutus/cooperate.php?link_source=1 last;
            rewrite ^/aboutus/Contact.html$ /aboutus/cooperate.php?link_source=3 last;
            rewrite ^/help/index.php$ /aboutus/cooperate.php?link_source=4 last;
            rewrite ^/aboutus/TermOfUse.html /aboutus/cooperate.php?link_source=5 last;
            rewrite ^/aboutus/Advice.html$ /aboutus/cooperate.php?link_source=6 last;
            rewrite /aboutus/cooperate.php$ /aboutus/cooperate.php?link_source=7 last;
            if ($query_string ~* ^act=baodao$)
            {
                rewrite ^/aboutus2/aboutusnew.php$ /aboutus/cooperate.php?link_source=2 last;
            }
            
            #������������ҳ
            if ($request_uri !~* ^/aboutus/cooperate.php$)
            {
                rewrite ^/aboutus/(.*?).(html|php)$ /aboutus2/aboutusnew.php?act=$1 last;
            }
            
            #���̴�ȫ����
            rewrite ^/zhaoshang.htm$ /tpl/a_d/zhaoshang.htm last;
            rewrite ^/daquan(d+)/([a-zA-Z]+)$ http://$host/daquan$1/$2/ redirect;
            rewrite ^/co/([a-zA-Z]+)$ http://$host/co/$1/ redirect;
            rewrite ^/daquan9/beijing/$ /a_d/daquan.php?id=9&db_city=beijing last;
            rewrite ^/daquan9/beijing(d+)/$ /a_d/daquan.php?id=9&db_city=beijing&districtid=$1 last;
            rewrite ^/co/([a-zA-Z]+)/$ /a_d/daquan.php?listPinyin=$1 last;
            rewrite ^/co/([a-zA-Z]+)/([a-zA-Z]+).htm$ /a_d/daquan.php?listPinyin=$1&districtid=$2 last;
            rewrite ^/daquan6/beijing/$ /a_d/daquan.php?id=6&db_city=beijing last;
            rewrite ^/daquan(d+)/([a-zA-Z]+)/$ /a_d/zhaoshang.php?id=$1&db_city=$2 last;
            rewrite ^/banjialist$ http://$host/banjialist/ redirect;
            rewrite ^/banjialist/$ /info/info_list.php?act=search&sort=service&list_type=2&ver=ad&district=-1 last;
            rewrite ^/banjialist(d+)/$ /info/info_list.php?act=search&sort=service&list_type=2&ver=ad&district=$1 last;
    
            #�����û�ǰ̨ҳ
            rewrite ^/vip/(d+)$ http://$host/vip/$1/ redirect;
            rewrite ^/vip/(d+)/$ /a_d/web_view.php?mcid=$1 last;
            
            #�µ�ͼƬ�б�ҳ����
            rewrite "^/pic/wu(d+)/$"  /info/info_list.php?act=2&district=-1&streetid=-1&ver=pic&sort=secondmarket&list_type=$1 last;
            rewrite "^/pic/([a-zA-Z]+)(d{1,2})/([^/]+).htm$" /info/info_list.php?sort=$1&list_type=$2&otherParam=$3&ver=pic last;
            rewrite "^/pic/([a-zA-Z]+)/(d+).htm$" /info/info_list.php?sortList=$1&otherParam=$2&ver=pic last;
    
            ##��������URL��д  YB
            rewrite ^/fang([0-9]+)/([0-9]+)/_(.*)$    /info/info_list.php?act=search&sortList=fang$1&keyword=$3&other=$2 last;
            rewrite ^/fang([0-9]+)/([0-9]+)/([a-zA-Z])([0-9]+)(.*)_(.*)$    /info/info_list.php?act=search&sortList=fang$1&keyword=$6&paran1=$3&paran2=$4&paran=$5&other=$2 last;
            rewrite ^/fang([0-9]+)/([0-9]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=fang$1&paran1=$3&paran2=$4&paran=$5&other=$2 last;
            rewrite ^/fang([0-9]+)/([a-zA-Z])([0-9]+)(.*)_(.*)$    /info/info_list.php?act=search&sortList=fang$1&keyword=$5&paran1=$2&paran2=$3&paran=$4 last;
            rewrite ^/fang([0-9]+)/_(.*)$    /info/info_list.php?act=search&sortList=fang$1&keyword=$2 last;
            rewrite ^/fang([0-9]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=fang$1&paran1=$2&paran2=$3&paran=$4last;
            rewrite ^/fang([0-9]+)/([a-zA-Z]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=$1&ver=new&paran=$5&paran1=$3&paran2=$4&threetag=$2 last;
            rewrite ^/jiaoyou([0-9]+)/([0-9]+)/_(.*)$    /info/info_list.php?act=search&sortList=jiaoyou$1&keyword=$3&other=$2 last;
            rewrite ^/jiaoyou([0-9]+)/([0-9]+)/([a-zA-Z])([0-9]+)(.*)_(.*)$    /info/info_list.php?act=search&sortList=jiaoyou$1&keyword=$6&paran1=$3&paran2=$4&paran=$5&other=$2 last;
            rewrite ^/jiaoyou([0-9]+)/([0-9]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=jiaoyou$1&paran1=$3&paran2=$4&paran=$5&other=$2 last;
            rewrite ^/jiaoyou([0-9]+)/([a-zA-Z])([0-9]+)(.*)_(.*)$    /info/info_list.php?act=search&sortList=jiaoyou$1&keyword=$5&paran1=$2&paran2=$3&paran=$4 last;
            rewrite ^/jiaoyou([0-9]+)/_(.*)$    /info/info_list.php?act=search&sortList=jiaoyou$1&keyword=$2 last;
            rewrite ^/jiaoyou([0-9]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=jiaoyou$1&paran1=$2&paran2=$3&paran=$4last;
            rewrite ^/huodong([0-9]+)/([0-9]+)/_(.*)$    /info/info_list.php?act=search&sortList=huodong$1&keyword=$3&other=$2 last;
            rewrite ^/huodong([0-9]+)/([0-9]+)/([a-zA-Z])([0-9]+)(.*)_(.*)$    /info/info_list.php?act=search&sortList=huodong$1&keyword=$6&paran1=$3&paran2=$4&paran=$5&other=$2 last;
            rewrite ^/huodong([0-9]+)/([0-9]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=huodong$1&paran1=$3&paran2=$4&paran=$5&other=$2 last;
            rewrite ^/huodong([0-9]+)/([a-zA-Z])([0-9]+)(.*)_(.*)$    /info/info_list.php?act=search&sortList=huodong$1&keyword=$5&paran1=$2&paran2=$3&paran=$4 last;
            rewrite ^/huodong([0-9]+)/_(.*)$    /info/info_list.php?act=search&sortList=huodong$1&keyword=$2 last;
            rewrite ^/huodong([0-9]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=huodong$1&paran1=$2&paran2=$3&paran=$4last;
            if ($request_uri !~* "^/xiaoqu/_fastcode/")
            {
                rewrite ^/([a-zA-Z]+)/_(.*)$    /info/info_list.php?act=search&sortList=$1&keyword=$2 last;
            }
            rewrite ^/([a-zA-Z]+)/([0-9]+)/_(.*)$    /info/info_list.php?act=search&sortList=$1&keyword=$3&ver=new&other=$2 last;
            rewrite ^/([a-zA-Z]+)/([a-zA-Z])([0-9]+)(.*)_(.*)$    /info/info_list.php?act=search&sortList=$1&keyword=$5&ver=new&paran=$4&paran1=$2&paran2=$3  last;
            rewrite ^/([a-zA-Z]+)/([0-9]+)/([a-zA-Z])([0-9]+)(.*)_(.*)$    /info/info_list.php?act=search&sortList=$1&keyword=$6&ver=new&paran=$5&other=$2&paran1=$3&paran2=$4 last;
            rewrite ^/([a-zA-Z]+)/([0-9]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=$1&ver=new&paran=$5&other=$2&paran1=$3&paran2=$4 last;
            rewrite ^/([a-zA-Z]+)/([a-zA-Z]+)/([0-9]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=$1&ver=new&paran=$6&other=$3&paran1=$4&paran2=$5&threetag=$2 last;
            if ($request_uri !~* "^/gmap")
            {
                rewrite ^/([a-zA-Z]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=$1&ver=new&paran=$4&paran1=$2&paran2=$3 last;
            }
            if ($request_uri !~* "^/tpl")
            {
                rewrite ^/([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z])([0-9]+)(.*)$    /info/info_list.php?act=search&sortList=$1&ver=new&paran=$5&paran1=$3&paran2=$4&threetag=$2 last;
            }
            rewrite ^/([a-zA-Z]+)/([a-zA-Z])/([0-9]+)/$    /info/info_list.php?act=search&sortList=$1&ver=new&other=$3&threetag=$2 last;
            
            #������ҳ����
            if ($host ~* ^(.*?).domain.com$)
            {
                set $var_info_city $1;
                rewrite "^/([a-zA-Z]+)(d+)/(d{6})(d{2})_(d+).htm$" /_script/info/detail.php?Sort=$1&list_type=$2&ID=$5&domain=$var_info_city last;
                rewrite "^/([a-zA-Z]+)(d+)d/(d{6})(d{2})_(d+).htm$" /_script/info/detail.php?Sort=$1&list_type=$2&ID=$5&domain=$var_info_city last;
                rewrite "^/([a-zA-Z]+)/(d{6})(d{2})_(d+).htm$" /_script/info/detail.php?sortList=$1&list_type=$2&ID=$4&domain=$var_info_city last;
            }
            if ($host !~* ^(.*?).domain.com$)
            {
                rewrite "^/([a-zA-Z]+)(d+)/(d{6})(d{2})_(d+).htm$" /_script/info/detail.php?Sort=$1&list_type=$2&ID=$5&domain=bj last;
                rewrite "^/([a-zA-Z]+)(d+)d/(d{6})(d{2})_(d+).htm$" /_script/info/detail.php?Sort=$1&list_type=$2&ID=$5&domain=bj last;
                rewrite "^/([a-zA-Z]+)/(d{6})(d{2})_(d+).htm$" /_script/info/detail.php?sortList=$1&list_type=$2&ID=$4&domain=bj last;
            }
            
            #�ض����ϵ��б�ҳ
            rewrite ^/([a-zA-Z]+)(d+).htm$ http://$host/$1$2/ redirect;
            rewrite ^/([a-zA-Z]+)$ http://$host/$1/ redirect;
            rewrite ^/fang(1|5)/geren/$ http://$host/fang$1/1/ redirect;
            rewrite ^/fang(1|5)/zhongjie/$ http://$host/fang$1/2/ redirect;
            rewrite ^/fang/$ /fang0/ last;
            rewrite ^/huodong/$ /huodong0/ last;
            rewrite ^/jiaoyou/$ /jiaoyou0/ last;
            rewrite "^/([a-zA-Z]+)(d{1,2})$" http://$host/$1$2/ redirect;
            rewrite "^/([a-zA-Z]+)(d{1,2})/$" /info/info_list.php?sort=$1&list_type=$2&topicPage=1&district=-1&streetid=-1 last;
            rewrite "^/([a-zA-Z]+)(d{1,2})/([^/]+).htm$" /info/info_list.php?sort=$1&list_type=$2&otherParam=$3 last;
    
            #�������е��б����ӡ���ҳ����
            if ($host ~* ^qita.domain.com$)
            {
                set $var_qita_city_index '1';
            }
            if ($request_uri ~* "^/(vip|admin)(.*)")
            {
                set $var_qita_city_index '0';
            }        
            if ($var_qita_city_index ~ '1')
            {
                rewrite ^/([a-zA-Z]+)/([a-zA-Z]+)(d*)$ http://$host/$1/$2$3/ redirect;
                rewrite ^/([a-zA-Z]+)/([a-zA-Z]+)(d*)/$ /info/info_list.php?cityPinyin=$1&sort=$2&listType=$3 last;
                rewrite ^/([a-zA-Z]+)$ http://$host/$1/ redirect;
                rewrite ^/([a-zA-Z]+)/$ /qita.php?pinyin=$1 last;
            }        
            
            #��ͬҳ
            rewrite ^/contract/(.*?).htm$ /contract/view_contract.php?name=$1 last;
            rewrite ^/contract/(.*?).doc$ /tpl/infolist1/contract/$1.doc last;
            
            #����portalҳ
            rewrite ^/(hao123|265)/$  /html/$1/beijing/index.htm last;
            rewrite ^/(hao123|265)/([a-zA-Z]+)/$  /html/$1/$2/index.htm last;
            rewrite ^/265/(.*?)/$  http://$host/a_d/linkpage/portal.php?url=$1.htm&adfrom=265 redirect;
            rewrite ^/9991/$  http://$host/a_d/linkpage/portal.php?adfrom=9991 redirect;
            rewrite ^/vnet/$  http://$host/a_d/linkpage/portal.php?adfrom=vnet redirect;
            
            #����ҳ����������
            rewrite /fang(d+)/(.*?)/(.*?)/(.*?)/(.*?).htm  /info/info_list.php?sort=housing&list_type=$1&district=$2&streetid=$3&$4=$5&act=search last;
            
            #�µ��б�ҳ����
            if (!-d $document_root$request_uri)
            {
                rewrite ^/([a-zA-Z]+)/$ /info/info_list.php?topicPage=1&district=-1&streetid=-1&ver=new&sortList=$1 last;
            }
            if (!-f $request_filename)
            {
                rewrite ^/([a-zA-Z]+)/(d+).htm$ /info/info_list.php?sortList=$1&otherParam=$2&ver=new last;
            }        
            
            rewrite ^/([a-zA-Z]+)/(d+)/$ /info/info_list.php?topicPage=1&district=-1&streetid=-1&ver=new&sortList=$1&param=$2 last;
            rewrite ^/([a-zA-Z]+)/(d+)/(d+).htm$ /info/info_list.php?sortList=$1&param=$2&otherParam=$3&ver=new last;
            rewrite "^/([a-zA-Z]+)(d{1,2})/(d+)/$" /info/info_list.php?sort=$1&list_type=$2&param=$3&topicPage=1&district=-1&streetid=-1 last;
            rewrite "^/([a-zA-Z]+)(d{1,2})/(d+)/([^/]+).htm$" /info/info_list.php?sort=$1&list_type=$2&param=$3&otherParam=$4 last;
            
            #������tag url��д
            if ($host !~* ^www.domain.com$)
            {
                rewrite "^/([a-zA-Z]+)/([A-Za-z]+)/$" /info/info_list.php?sortList=$1&threetag=$2&ver=new last;
                rewrite "^/([a-zA-Z]+)(d{1,2})/([A-Za-z]+)/$" /info/info_list.php?sort=$1&list_type=$2&threetag=$3&district=-1&streetid=-1&ver=new last;
                rewrite "^/([a-zA-Z]+)(d{1,2})/([A-Za-z]+)/([0-9]+).htm$" /info/info_list.php?sort=$1&list_type=$2&threetag=$3&district=-1&streetid=-1&ver=new&otherParam=$4 last;
            }
            
            #�б�ҳURL��ʽ����
            rewrite ^/([a-zA-Z]+)/([A-Za-z]+)/([0-9]+).htm$ /info/info_list.php?sortList=$1&threetag=$2&ver=new&otherParam=$3 last;
            if ($host !~* ^www.domain.com$)
            {
                rewrite "^/([a-zA-Z]+)(d{1,2})/([A-Za-z]+)/$" /info/info_list.php?sort=$1&list_type=$2&threetag=$3&district=-1&streetid=-1&ver=new last;
                rewrite "^/([a-zA-Z]+)(d{1,2})/([A-Za-z]+)/([0-9]+).htm$" /info/info_list.php?sort=$1&list_type=$2&threetag=$3&district=-1&streetid=-1&ver=new&otherParam=$4 last;
            }
    
            #��ѧ
            if ($host ~* ^(.*?).domain.com$)
            {
                set $var_daxue_city $1;
                set $var_daxue '1';
            }
            if ($var_daxue ~ '1')
            {
                rewrite ^/edu-(.*?)/xiaochi-list/(.*?).htm$  /daxue/collegeXiaochiList.php?city=$var_daxue_city&college=$1&page=$2  last;
                rewrite ^/edu-(.*?)/xiaochi/(.*?).htm$  /daxue/collegeXiaochiDetail.php?city=$var_daxue_city&college=$1&aid=$2  last;
                rewrite ^/edu-(.*?)/$  /daxue/collegeIndex.php?city=$var_daxue_city&college=$1  last;
                rewrite ^/edu-(.*?)/(.*?).htm$  /daxue/collegeInfoDetail.php?city=$var_daxue_city&college=$1&action=$2  last;
            }
            
            #ʹ��FastCGI������PHP����
            location ~* .*.(php|html)?$
            {      
                 #fastcgi_pass  unix:/tmp/php-cgi.sock;
                 fastcgi_pass  127.0.0.1:9000;
                 fastcgi_index index.php;
                 include fcgi.conf;
            }
    
            #�ܾ���������Щ��չ����β��URL
            location ~* .*.(local|production|test|ini|sh)?$
            {      
                 return 403;
            }    
            
            #����ͼƬ�ļ����������ػ�������Ϊ365��
            location ~* .*.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      365d;
            }
    
            #����js��css�ļ����������ػ�������Ϊ1��
            location ~* .*.(js|css)?$
            {
                expires      1d;
            }
    
            #����htm�ļ����������ػ�������Ϊ10����
            location ~* .*.(htm|flv)?$
            {
                expires      10m;
            }        
            
            log_format  access  '$remote_addr $host $server_addr [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent"';
            access_log  /domain/logs/access.log  access;
         }
         
        server
        {
            listen       80;
            server_name  domain.tom.com;
            index index.php index.htm index.html;
            root  /server/www/domain;
    
            add_header Load-Balancing $server_addr;
    
            error_page 404 /_script/error404.php;        
    
            #TOM����
            rewrite ^/$ /html/tom/beijing/index.htm last;
            if ($request_uri ~* "^/$")
            {
                set $var_tom '1';
            }
            if ($request_uri ~* "^/(.*?).htm$")
            {
                set $var_tom '1';
            }
            if ($request_uri ~* ".*.(gif|jpg|jpeg|png|bmp|swf|flv|js|css)$")
            {
                set $var_tom '1';
            }        
            if ($var_tom !~ '1')
            {
                rewrite ^/(.*)$ http://www.domain.com/ redirect;
            }
            
            access_log  off;
        }
    }
  • 相关阅读:
    Java Mybatis 传参方式
    html Js跨域提交数据方法,跨域提交数据后台获取不到数据
    uuidgen
    shell 案例
    docker搭建tomcat环境
    redis主从+哨兵模式(借鉴)
    ansible-playbook 案例
    NFS
    mysql -sql语句
    定时任务crontab命令
  • 原文地址:https://www.cnblogs.com/Oman/p/3217363.html
Copyright © 2020-2023  润新知