Hi Johan,<div><br></div><div>Sorry for the delay. I have the Nginx file upload module working. In case it's still useful here's the relevant portions of my nginx configuration:</div><div><br></div><div><div> upstream seaside {</div>
<div> server <a href="http://127.0.0.1:9001">127.0.0.1:9001</a>;</div><div> server <a href="http://127.0.0.1:9002">127.0.0.1:9002</a>;</div><div> server <a href="http://127.0.0.1:9003">127.0.0.1:9003</a>;</div>
<div> fair;</div><div> }</div><div><br></div><div> server {</div><div> listen 80 default;</div><div> server_name <a href="http://www.getitmade.com">www.getitmade.com</a>; </div><div> # server_name _;</div>
<div> root /var/www;</div><div><br></div><div> location / {</div><div> try_files $uri @seaside;</div><div> }</div><div><br></div><div> # ensure that files are searched for locally and not passed to the</div>
<div> # Gems if the file isn't found on the disk</div><div> location ~* \.(gif|jpg|jpeg|png|css|html|htm|js|zip)$ {</div><div><br></div><div> }</div><div><br></div><div> location ~ fileupload {</div>
<div> # Pass altered request body to this location</div><div> upload_pass @seaside;</div><div><br></div><div> # if there's no upload file in this request, nginx generates a 405 - we use this</div>
<div> # to pass the request onto the 'normal' seaside processing</div><div> # The way this is achieved in the other location directives is through a "try_files" method</div><div> # however using "try_files" results in the other directives never being processed</div>
<div> error_page 405 415 = @seaside;</div><div><br></div><div> # Store files to this directory</div><div> # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist</div><div>
upload_store /var/nginx/temp 1;</div><div><br></div><div> # Set the file attributes for uploaded files</div><div> upload_store_access user:rw group:rw all:rw;</div><div><br></div><div> # Set specified fields in request body</div>
<div> upload_set_form_field $<a href="http://upload_field_name.name">upload_field_name.name</a> "$upload_file_name";</div><div> upload_set_form_field $upload_field_name.content_type "$upload_content_type";</div>
<div> upload_set_form_field $upload_field_name.path "$upload_tmp_path";</div><div><br></div><div> # Inform backend about hash and size of a file</div><div> # upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";</div>
<div> upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";</div><div><br></div><div> # seaside automatically assigns sequential integers to fields with callbacks</div>
<div> # we want to pass those fields to the backend </div><div> upload_pass_form_field "^\d+$";</div><div><br></div><div> # we don't want files hanging around if the server failed to process them.</div>
<div> upload_cleanup 500-505;</div><div><br></div><div> # file upload progress tracking - 30s is the timeout (progress tracking is</div><div> # available 30s after the upload has finished)</div>
<div> # this must be the last directive in the location block.</div><div> track_uploads proxied 30s;</div><div> }</div><div><br></div><div> # used to report upload progress - defined by the Nginx Upload Progress Module</div>
<div> # see <a href="http://wiki.nginx.org/HttpUploadProgressModule">http://wiki.nginx.org/HttpUploadProgressModule</a></div><div> location /progress {</div><div> report_uploads proxied;</div><div> }</div>
<div><br></div><div> location @seaside {</div><div> include /etc/nginx/fastcgi_params;</div><div> fastcgi_intercept_errors on;</div><div> fastcgi_pass seaside;</div><div> }</div><div>
<br></div><div> location /nginx_status {</div><div> # copied from <a href="http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/">http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/</a></div>
<div> stub_status on;</div><div> access_log off;</div><div> allow 127.0.0.1;</div><div> deny all;</div><div> }</div><div><br></div><div> error_page 404 /errors/404.html;</div><div>
error_page 403 /errors/403.html;</div><div> error_page 500 502 503 504 /errors/50x.html;</div><div> }</div></div><div><br></div><div><br></div><div><br><br><div class="gmail_quote">On 12 June 2011 10:28, Johan Brichau <span dir="ltr"><<a href="mailto:johan@inceptive.be">johan@inceptive.be</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi all,<br>
<br>
I'm calling for people who have got the nginx file upload module to work in their seaside apps...<br>
<br>
We are trying to use the Nginx file upload module but are stuck when the request needs to get passed on to seaside.<br>
We are using a configuration with a separate '/upload' location that gets handled by the file upload module. The request then needs to get passed to the upstream backend (seaside) but that request still has the URI '/upload' and we do not seem to get it rewritten to the '/seasideapp' URI.<br>
<br>
<br>
Is there anyone who has this working completely and could give us some advice on how solve this?<br>
<br>
The relevant parts of our nginx conf look like this:<br>
We also tried with a named location, but according to the docs, that makes the request arguments be dropped (and we need the _s & _k args for seaside...)<br>
<br>
Johan<br>
<br>
----<br>
<br>
location / {<br>
include fastcgi_params;<br>
fastcgi_pass seaside;<br>
}<br>
<br>
# Upload form should be submitted to this location<br>
location /upload {<br>
<br>
# Pass altered request body to this location<br>
upload_pass /backend;<br>
upload_pass_args on;<br>
<br>
<br>
#Pass all fields of the form<br>
upload_pass_form_field ".*";<br>
<br>
# Store files to this directory<br>
upload_store /var/www/documents/;<br>
<br>
# Set specified fields in request body<br>
upload_set_form_field $<a href="http://upload_field_name.name" target="_blank">upload_field_name.name</a> "$upload_file_name";<br>
upload_set_form_field $upload_field_name.content_type "$upload_content_type";<br>
upload_set_form_field $upload_field_name.path "$upload_tmp_path";<br>
<br>
upload_cleanup 400 404 499 500-505;<br>
}<br>
<br>
location /backend<br>
{<br>
rewrite ^/upload/(.*) /seasideapp/$1 last;<br>
}_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</blockquote></div><br></div>