文件上传出错

来源:5-22 Nginx安全_文件上传漏洞

OneSummerNight

2019-11-28

这边想用Nginx上传图片。
设置的upload_pass 想跳到PHP 的file控制器 执行
但是upload_pass 没有生效
最终执行的控制器为/nginx-upload/index
前端访问是:www.xxxx.com/nginx-upload?sin=XXXXXXXX&child=xxxxxx

**文件上传**
location =/nginx-upload {		
            upload_pass   /file/images;
            upload_store /home/file;
            upload_store_access user:r;
            upload_set_form_field "${upload_field_name}_name" $upload_file_name;
            upload_set_form_field "${upload_field_name}_content_type" $upload_content_type;
            upload_set_form_field "${upload_field_name}_path" $upload_tmp_path;
            upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5;
            upload_aggregate_form_field "${upload_field_name}_size" $upload_file_size;
            upload_pass_form_field "^.*$";
            track_uploads proxied 30s; #
	break;
    }
# php-yii2.0 重写
location / {

    # Redirect everything that isn't a real file to index.php
    try_files $uri $uri/ /index.php$is_args$args;
}
#  PHP-pathinfo 解析 
location ~ [^/].php(/|$)
        {	        
            fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
            fastcgi_split_path_info ^(.+?.php)(/.*)$;
		   set $path_info $fastcgi_path_info;
		   fastcgi_param PATH_INFO       $path_info;
		    try_files $fastcgi_script_name =404;
        }
写回答

2回答

OneSummerNight

提问者

2019-12-03

很少的错误日志//img1.sycdn.imooc.com/szimg/5de5db1109800c9917120179.jpg

0
0

Jeson

2019-11-29

nginx错误日志有什么信息?

上传后反馈有错误提示吗?

0
1
OneSummerNight
nginx并没有报错
2019-12-03
共1条回复

Nginx入门到实践-Nginx中间件应用+搭建Webserver架构

中间件、负载均衡、应用层安全防护、动静分离、Nginx+LUA开发等

4183 学习 · 908 问题

查看课程