Jump to content
  • 0

File Uploads With Nginx & Ssl


Question

Posted

Does anyone else have issues trying to upload files via the Support Manager in Blesta? Uploads work fine using Nginx/PHP and Nginx/RoR with plain HTTP. But with Blesta and HTTPS it doesn't seem to work.

 

 

The folder is writable.

Blesta gives this error

  Quote

 

 

The file could not be written.

 

Nginx logs


2013/12/17 08:14:51 [warn] 2651#0: *50775 an upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/7/05/0000000057 while reading upstream, client: 111.111.111.111, server: my.cloudrck.com, request: "GET /admin/clients/viewinvoice/23/107/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "my.cloudrck.com", referrer: "https://my.cloudrck.com/admin/clients/view/23/"
2013/12/18 04:17:46 [warn] 2650#0: *58956 an upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/8/06/0000000068 while reading upstream, client: 111.111.111.111, server: my.cloudrck.com, request: "GET /client/invoices/view/105/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "my.cloudrck.com", referrer: "https://my.cloudrck.com/client/"
2013/12/18 13:29:55 [error] 2653#0: *63423 client intended to send too large body: 1670524 bytes, client: 111.111.111.111, server: my.cloudrck.com, request: "POST /client/plugin/support_manager/client_tickets/reply/108/ HTTP/1.1", host: "my.cloudrck.com", referrer: "https://my.cloudrck.com/client/plugin/support_manager/client_tickets/reply/108/"

I've searched online and saw a few people with the same issues but with no solution. This appears to be an issue with using SSL. My client_max_body_size setting doesn't seem to matter.

18 answers to this question

Recommended Posts

  • 0
Posted

It works for us, but we may be doing it differently. We do SSl termination on a Nginx proxy which then passes through to a different Nginx server running Blesta in clear text.

 

I've never seen the 'client intended to send too large body' error before. Normally it would be a 413 Request Entity Too Large if it was a matter of max_client_size.

 

Would you mind posting the relevant bits of your configuration?

  • 0
Posted
  On 6/15/2014 at 6:39 PM, naja7host said:

have you test a simple upload form in php ?

I think I had tested Blesta on non-ssl and it worked. Never tested a regular upload i don't think, it's been some time since I tried to troubleshoot this. I'll do that next

  On 6/15/2014 at 8:56 PM, ServZoo said:

It's interesting... I can upload screenshots in the Support Manager Pro plugin, but I can't upload my logo for my custom invoices. 

Are you running PHP-FPM?

  • 0
Posted (edited)

This would be easier if there were any error messages, but PHP/Nginx don't log any errors. Blesta only says it can't upload the file.

 

@ServZoo what error messages are you getting?

 

EDIT

I enabled error reporting and logging for all errors.

 catch (Exception $e) {
                        // file could not be written

                        error_log($e->getMessage(), 3, "/tmp/my-errors.log");
                }

This is what I'm getting now. Even if I change the tmp directory, it still tries /tmp

 

  Quote

 

rename(/tmp/phpfrWNyq,/home/user/blesta/uploads/1/support_manager_files/20140622T172139+0000_394003b2935a79907e02727573b6b20f.jpg): No such file or directory

Edited by cloudrck
  • 0
Posted
  On 6/22/2014 at 5:03 PM, cloudrck said:

This would be easier if there were any error messages, but PHP/Nginx don't log any errors. Blesta only says it can't upload the file.

 

@ServZoo what error messages are you getting?

 

EDIT

I enabled error reporting and logging for all errors.

 catch (Exception $e) {
                        // file could not be written

                        error_log($e->getMessage(), 3, "/tmp/my-errors.log");
                }

This is what I'm getting now. Even if I change the tmp directory, it still tries /tmp

try to change the tmp directory in php.ini ? and make it under the user account .

  • 0
Posted
  On 6/23/2014 at 1:23 AM, naja7host said:

try to change the tmp directory in php.ini ? and make it under the user account .

No, I was going to try that, but it seemed like it would makre things more complicated by declaring/restricting directories.

 

  On 6/23/2014 at 4:31 PM, Tyson said:

 

Does this path exist, and is it writable?

/home/user/blesta/uploads/1/support_manager_files/

Wow, that fixed it. Shouldn't these directories have been created by blesta? Did I miss this in the documentation?

  • 0
Posted
  On 6/23/2014 at 7:10 PM, cloudrck said:

No, I was going to try that, but it seemed like it would makre things more complicated by declaring/restricting directories.

 

Wow, that fixed it. Shouldn't these directories have been created by blesta? Did I miss this in the documentation?

 

Should be automatically created if the upload folder is 777 or 666 or whatever :) when installing the plugin.

  • 0
Posted
  On 6/23/2014 at 7:10 PM, cloudrck said:

Wow, that fixed it. Shouldn't these directories have been created by blesta? Did I miss this in the documentation?

The Support Manager attempts to create the directory when installed, yes. However, if you have an invalid uploads directory set (under [settings] -> [Company] -> [General] -> [basic Setup]) at the time you install the plugin, or your user does not have permissions enabled to create a directory at that path on the server, it could fail to do so.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...