cakephp+nginx 的路径重写

 server

  {
    listen       123.183.209.32;
    server_name  mytest.lrenwang.com;
    index index.html  index.php;
    root  /var/www/mytest;

    if (-f $request_filename) {
    break;
    }
    if (!-f $request_filename) {

  rewrite ^/files/(.+)$ /app/webroot/files/$1 last;
    rewrite ^/img/(.+)$ /app/webroot/img/$1 last;
    rewrite ^/css/(.+)$ /app/webroot/css/$1 last;
    rewrite ^/js/(.+)$ /app/webroot/js/$1 last;
    rewrite ^/(.+)$ /index.php?url=$1 last;
    break;
    }


    location ~ .*\.(php|php5)?$
    {
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }

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

你可能感兴趣的:(nginx,cakephp)