|
发表于 2016-2-10 17:02:30
|
显示全部楼层
我的规则是这样的- server {
- listen 81;
- server_name localhost;
- index index.html index.htm index.php;
- root /alidata/www/ci;
-
- location ~ \\.php{
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- ##########################################pathinfo 模式
- set $path_info "";
- set $real_script_name $fastcgi_script_name;
- if ($fastcgi_script_name ~ "^(.+?\\.php)(/.+)$"){
- set $real_script_name $1;
- set $path_info $2;
- }
- include fastcgi.conf;
- fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
- fastcgi_param SCRIPT_NAME $real_script_name;
- fastcgi_param PATH_INFO $path_info;
- ##########################################nginx支持pathinfo 模式的重点
- }
-
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- {
- expires 30d;
- }
-
- location ~ .*\.(js|css)?$
- {
- expires 1h;
- }
-
- rewrite .*/(statics|uploads)/(.*)$ /$1/$2 last;//这里 rewrite的时候 排除statics目录和uploads目录,这样将你的静态文件放到statics目录下就能正常引入了
- rewrite /.* /index.php break;
-
- access_log /alidata/log/nginx/access/ci.log;
- }
复制代码 |
|