http://www.linuxidc.com/Linux/2011-07/38125.htm




img.xxxx.com



nginx   configTest


add_header Access-Control-Allow-Origin *;
log_format zuren  '$remote_addr - $remote_user [$time_local] '
                    '$request_time $upstream_response_time "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';


server{
  listen 80;
  server_name img.xxxx.com;
  index index.php;
  root  /data/www/img;


 if (!-e $request_filename) {
            rewrite ^/(.*)$ /index.php/$1 last;
        }

    location /.git {
        deny all;
        return 403;
    }


    location ~ .*\.php[/]?
    {
      include php_fcgi.conf;
      include pathinfo.conf;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }

    location ~ .*\.(js|css)?$
    {
      expires      1h;
    }

    access_log /var/log/nginx/img.log  zuren;
  #  access_log off;

}