cakephp+nginx 的路径重写
server{
listen 123.183.209.32;
server_namemytest.lrenwang.com;
index index.htmlindex.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_passunix:/tmp/php-cgi.sock;
fastcgi_pass127.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;
}
}
页:
[1]