O
O
orthanner2013-04-30 02:26:54
Nginx
orthanner, 2013-04-30 02:26:54

Nginx+Ruby: File upload not working?

An unpleasant moment of using Redmine under Nginx was found out. According to the documentation, everything should work, but in practice it is not possible to upload files to Redmine. With direct access to the application (in addition to Nginx), everything is ok. Server config:

upstream rails_redmine {<br>
        server unix:/tmp/unicorn-redmine.sock fail_timeout=0;<br>
}<br><br>
server {<br>
        listen 80;<br><br>
        server_name dev.site.tld;<br><br>
        root /var/www/sites/dev.site.tld/redmine/public;<br><br>
        keepalive_timeout 5;<br><br>
        try_files $uri/index.html $uri.html $uri @app;<br><br>
        access_log /var/log/nginx/dev.site.tld_access.log;<br>
        error_log /var/log/nginx/dev.site.tld_error.log;<br><br>
        error_page 500 502 503 504 /500.html;<br><br>
        location @app {<br>
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>
                proxy_set_header X-Forwarded-Proto $scheme;<br>
                proxy_set_header X-Real-IP $remote_addr;<br>
                proxy_set_header Host $http_host;<br>
                proxy_redirect off;<br>
                proxy_pass http://rails_redmine;<br>
                client_max_body_size       10m;<br>
                client_body_buffer_size    128k;<br><br>
                proxy_connect_timeout      90;<br>
                proxy_send_timeout         90;<br>
                proxy_read_timeout         90;<br><br>
                proxy_buffer_size          4k;<br>
                proxy_buffers              4 32k;<br>
                proxy_busy_buffers_size    64k;<br>
                proxy_temp_file_write_size 64k;<br>
        }<br><br>
        location = /favicon.ico {<br>
            log_not_found off;<br>
            access_log off;<br>
        }<br><br>
        location = /robots.txt {<br>
            allow all;<br>
            log_not_found off;<br>
            access_log off;<br>
        }<br><br>
        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {<br>
            expires max;<br>
            log_not_found off;<br>
        }<br><br>
        location = /500.html {<br>
                root /var/www/sites/dev.site.tld/redmine/public;<br>
        }<br>
}<br>

There are no errors in the logs.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Renat Ibragimov, 2013-04-30
@MpaK999

Check from whom Unicorn is launched and what rights and who owns the redmine folders, most likely you need to correct the rights to the folder where you upload.

O
orthanner, 2013-05-13
@orthanner

Launched, works. Sorry for the long silence.
And what is especially interesting - it works even through nginx. I already tried to download in redmine, but no.
And there are no errors in the logs...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question