您的位置:首页 > 运维架构 > Nginx

CI框架Nginx重写规则

2012-07-20 09:55 423 查看
东西是参考了CU上一哥们的博文,按他的方法没成功我自己改了下,反正现在按这样配是可以重写过来了。网上有的文章说要把 “location ~ \.(php|php5)?$”后面的$去掉,但是我去掉之后url无限跳转增加.有的说要开php_info,我开了也没用

server

{
listen 80;
server_name xxxx.xxxxx.com;
root /home/wwwroot/xxxx;

location / {
index index.html index.htm index.php;
rewrite ^/(.+)$ /index.php last;

}

location ~ \.(php|php5)?$
{

fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}

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

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

access_log off;
}
~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: