AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 531796
Accepted
sweb
sweb
Asked: 2013-08-19 03:06:45 +0800 CST2013-08-19 03:06:45 +0800 CST 2013-08-19 03:06:45 +0800 CST

nginx上传进度结合正常请求

  • 772

我有一个很好的 nginx 虚拟主机,它在不使用 nginx 上传模块的情况下运行良好。 当我将上传进度添加到我的上传请求中时。我该如何解决这个问题?我需要使用或使用或其他方式上传我的文件/?r=upload并/upload?foo=bar跟踪上传进度数据/progress。

# static9-localhost.sweb
server {

        # upload limit
        # upload_limit_rate 10240;

        # request size limitation
        client_max_body_size 500m;
        client_body_buffer_size 64k;

        # document root
        root /path/to/webapp/static/public/;

        # index file
        index index.php;

        # server name
        server_name static9-localhost.sweb;

        # rewrite rules
        rewrite "^/thumbnail/([A-Za-z0-9]{12})/(.*)/.*$" /index.php?r=thb&unique=$1&prm=$2 last;

        # /
        location @frontcontroller {
                # expires
                expires max;

                # disable etag
                if_modified_since off;
                add_header 'Last-Modified' '';

                # mvc rewrite
                try_files $uri $uri/ /index.php?$uri&$args;
        }

        # upload progress
        location /upload {
                upload_pass @frontcontroller;
                track_uploads proxied 600s;
        }

        # progress
        location = /progress {
                report_uploads proxied;
        }

        # error pages
        error_page 404 /index.php?r=404;
        error_page 403 /index.php?r=403;
        error_page 500 501 502 503 504 /index.php?r=500;

        # php5-fpm
        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9003;
                fastcgi_index index.php;
                fastcgi_read_timeout 300;
                include fastcgi_params;
        }

        # logs
        access_log /path/to/webapp/logs/static_access.log;
        error_log /path/to/webapp/logs/static_error.log;
} 

对于上述虚拟主机,我的上传请求/upload/?X-Progress-ID=QLiFKnG5A81K冻结。问题是什么?

/?r=blahblah如果我将上传文件发送到/uploadusing中,我也需要这样的请求才能正常工作/?r=upload。

nginx
  • 1 1 个回答
  • 1545 Views

1 个回答

  • Voted
  1. Best Answer
    Glueon
    2014-10-07T11:40:24+08:002014-10-07T11:40:24+08:00

    我通过我的配置查看了一个工作示例。我以这样的方式使用上传模块和上传进度:

        upload_progress proxied 4m;
        ...
        server {
            ...
    
            location ^~ /progress {
                    report_uploads proxied;
            }
    
            location ^~ /services/ {
                   rewrite ^/(.*?)/?$ /$1.php break;
                   fastcgi_pass unix:/var/run/php5-fpm.sock;
                   include fastcgi_params;
            }
    
            location ^~ /upd/ {
                   upload_pass   /services/upload/;
                   upload_pass_args on;
                   upload_store_access group:rw;
                   upload_store /tmp;
    
                   set $upload_field_name file;
                   upload_set_form_field $upload_field_name.name "$upload_file_name";
                   upload_set_form_field $upload_field_name.path "$upload_tmp_path";
                   upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";
                   upload_cleanup 400 404 499 500-505;
                   track_uploads proxied 30s;
           }
      }
    

    另请查看 firebug Net 选项卡。查看您的代码是否获得正确的 json 输出。也许问题真的出在客户端。

    • 1

相关问题

  • Gzip 与反向代理缓存

  • nginx 作为代理的行为

  • Nginx 学习资源 [关闭]

  • 提供 70,000 个静态文件 (jpg) 的最佳方式?

  • 在 Apache、LightTPD 和 Nginx Web 服务器上提供 PHP 5.x 应用程序的现状?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve