server {
    listen       80 ;
    server_name  test.com www.test.com;
        index index.html index.php index.htm;
        root /alidata/www/test/public/;

        if ( $query_string ~* ".*[\;'\<\>].*" ){
            return 404;
        }


            return 404;
        }


    location  / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    if (!-f $request_filename){
         rewrite ^/(.+)$ /index.php?$1& last;
    }


        location ~ .*\.(php|php5)?$
        {
          if ( $host != 'test.com' ) {
            rewrite ^/(.*)$ http://test.com permanent;
        }

                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi.conf;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
                expires 30d;
        }
        location ~ .*\.(js|css)?$
        {
                expires 1h;
        }
        access_log  /alidata/log/nginx/access/default.log;
}

  

posted on 2016-02-18 20:51  FreeSpider  阅读(238)  评论(0编辑  收藏  举报