Tôi có một máy chủ ảo tốt cho nginx hoạt động tốt mà không cần sử dụng mô-đun tải lên nginx.
Khi tôi thêm tiến trình tải lên vào yêu cầu tải lên của tôi. Làm sao tôi có thể giải quyết việc này? tôi cần tải lên các tập tin của mình bằng cách sử dụng /?r=upload
hoặc /upload?foo=bar
theo dõi dữ liệu tiến trình tải lên bằng cách sử dụng /progress
hoặc một cái gì đó khác.
# 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;
}
Đối với máy chủ ảo ở trên, yêu cầu tải lên của tôi /upload/?X-Progress-ID=QLiFKnG5A81K
bị đóng băng. vấn đề là gì
Tôi cần yêu cầu như /?r=blahblah
để hoạt động tốt nếu tôi gửi tệp tải lên của mình vào /upload
sử dụng /?r=upload
.
upload_progress <zone_name> <zone_size>
chỉ thị trênlocation /upload
khối, cho phép theo dõi tiến trình tải lên, như đã nêu trên tài liệu nginx ( wiki.nginx.org/HttpUploadProTHERModule#upload_proTHER ).