opencart nginx 伪静态

server{
    listen       80;
    server_name facesoho.com www.facesoho.com ;
    index index.html index.php default.html default.htm default.php;
    root  /data/wwwroot/www.facesoho.com;
  if ($uri ~ "/Admin/" ){   break; }    
    location / {
        try_files $uri @opencart;
    }    
    location @opencart {
        rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }   
   location /Admin {
        index index.php;
    }
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    # Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
    location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
        deny all;
    }
    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }
    location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
        expires max;
        log_not_found off;
    }
  rewrite ^/product/download/index_([0-9]+).html$ /index.php?route=product/download&page=$1[L,QSA];
  rewrite /(product/download/$|^product/download/index.html$|^product/download$) /index.php?route=product/download last;
  rewrite ^/product/download/download&download_id=(.*)$ /index.php?route=product/download/download&download_id=$1 last;    

if ($uri ~ ".(js|css)") { rewrite ^/(.*)$ /FaceSohoGzip.php?$uri&sign=1 break; }
if ($uri ~ ".css"){ rewrite ^/(.*)$ /FaceSohoGzip.php?$1 break; }
if ($uri ~ ".(gif|jpg|jpeg|png|js|ico|css|php|txt|swf)$"){ break; }
    location ~ .*\.(php|php5)?$
    {
        try_files $uri =404;
        fastcgi_pass  unix:/tmp/php-cgi.sock;
        if (!-f $request_filename){set $rule_0 1$rule_0;}
        if (!-d $request_filename){set $rule_0 2$rule_0;}
        if ($rule_0 = "21"){rewrite ^/([^?]*) /index.php?_route_=$1 last;}
        fastcgi_index index.php;
        include /usr/local/nginx/conf/fastcgi.conf;
    }
    access_log off;
}