rewrite ^(.*?)api.php/(.*)$ $1api.php?$2;
if (!-e $request_filename){
rewrite ^(.*?)index.php/(.*)$ $1index.php?$2;
rewrite (.*) /index.php/$1;
}
}
其它说明 : 在Apache、Lighttpd无此问题
完整配置文件下面是demo.miniyun.cn的部署方式,可供参考
假设
迷你云代码在/home/webadmin/programs/miniyun/production/miniyun-demo目录下
通过fastcgi与PHP关联
server {
listen 80;
server_name demo.miniyun.cn;
index index.html index.htm index.php;
root /home/webadmin/programs/miniyun/production/miniyun-demo;
client_max_body_size 10240m;
#charset koi8-r;
# 图片缓存
#location ~* .(?:ico|gif|jpe?g|png|bmp|swf)$ {
# # Some basic cache-control for static files to be sent to the browser
# expires max;
# add_header Pragma public;
# add_header Cache-Control "public, must-revalidate, proxy-revalidate";
#}
# 静态资源缓存
#location ~.*.(js|css)?$
#{
# expires 1h;
#}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
fastcgi_pass phpfpm;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/webadmin/programs/miniyun/production/miniyun-demo$fastcgi_script_name;
include fastcgi_params;
# add PATH_INFO to support hide index.php
#
fastcgi_param PATH_INFO $fastcgi_script_name;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
location / {
rewrite ^(.*?)api.php/(.*)$ $1api.php?$2;
if (!-e $request_filename){
rewrite ^(.*?)index.php/(.*)$ $1index.php?$2;
rewrite (.*) /index.php/$1;
}
}
}
Nginx使用X-SendFile1、在nginx.conf配置文件的对于域名下面添加这样的值
请注意了:/home/webadmin/demo/upload/,是你设置的存在位置
location /download/ {internal;
alias /home/webadmin/demo/upload/;
}
2、修改{protectedconfigminiyun_config.php}
define('X_SEND_FILE', TRUE);define('NGINX_SEND_FILE_TAG', '/download');
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。