Nginx - >上传文件=错误(需要重写)

时间:2014-11-03 15:08:04

标签: php file-upload nginx helpers

我使用XenForo并且存在一些问题 - 我无法将任何文件上传到/ var / www / internal_data / attachments / 0;

完全chmod到0777'。 我不知道,我试图使用重写,但我仍然收到上传错误。

这是我的nginx配置的默认文件:

    server {
   listen         80;
   listen   [::]:80 default ipv6only=on; 
   server_name  domain www.domain.com;
   root   /var/www;
   index  index.html index.htm index.php;

    location / {
    try_files $uri $uri/ =404;
}
    error_page 403 404 405 /40x.html;
    location /40x.html {
        root /somepath;
        internal;
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /somepath;
        internal;
    }

    location ~ \.php$ {
    root /var/www;
    index index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

  location ~ /\.ht {
        deny all;
    }
}


 client_max_body_size 50M;



#POST URLn
    location /var/www/ {
        # Pass altered request body to this location
        upload_pass @after_upload;

        # Store files to this directory
        upload_store /var/www/internal_data/attachments/0;

        # Allow uploaded files to be read only by user
        upload_store_access user:rw;

        # Set specified fields in request body
        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”;

        # Inform backend about hash and size of a file
        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 “some_hidden_field_i_care_about”;

        upload_cleanup 400 404 499 500-505;
    }

location / {
        root   /var/www;
    }


    location @after_upload {
        proxy_pass   http://127.0.0.1:8888;
    }

}
}

那里有什么问题?谢谢你的回答。

0 个答案:

没有答案