How to solve 500 internal server error problem when uploading files once and for all

Added by Matteo Bagattini over 4 years ago

Dear folks,
I've seen lot of messages here about how to solve the "Internal server error" problem due to files folder ownership and this fix works (changing ownership to www-data).

Problem is that every month Redmine creates a new folder under the "year" one, using the number of the month, and we're back again to the ownership thing: is there a way to fix this once and for all? I'm no *nix expert so I don't want to make a mess: my idea is to pre-create "years" and "months" folders beforehand for the next years, and give them the right ownership. I suppose that if the program finds the right folder (say, /2015/07 next july) it would skip the folder creation and the ownership issue is at least dodged.

Am I right?

Thanks in advance.

mt

Replies (4)

RE: How to solve 500 internal server error problem when uploading files once and for all - Added by Pavel Potcheptsov over 4 years ago

You need to run redmine with same user as your folders owner.

RE: How to solve 500 internal server error problem when uploading files once and for all - Added by Junyu Jiang over 3 years ago

Strange, I also have same problem.
Everymonth, the new created directory's owner is root

total 20
drwxrwxr-x 2 www-data www-data 4096 Jan 28 09:32 01
drwxrwxr-x 2 www-data www-data 4096 Feb 24 13:35 02
drwxrwxr-x 2 www-data www-data 4096 Mar 30 16:03 03
drwxrwxr-x 2 www-data www-data 4096 Apr 25 11:20 04
drwxr-xr-x 2 root     root     4096 May 10 17:18 05

in the passenger.conf, default user is www-data already.

<IfModule mod_passenger.c>
  PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
  PassengerDefaultRuby /usr/bin/ruby
  PassengerDefaultUser www-data
</IfModule>

I also check the processor, the app is executed in the owner of www-data

root     17011  0.0  0.0 215184  1832 ?        Ssl  May09   0:00 PassengerWatchdog
root     17014  0.1  0.0 833976  3340 ?        Sl   May09   2:19 PassengerHelperAgent
nobody   17020  0.0  0.0 231792  4492 ?        Sl   May09   0:00 PassengerLoggingAgent
www-data 17511  0.0  0.9 473024 161684 ?       Sl   May09   0:29 Passenger RackApp: /usr/share/redmine  

Any idea?

RE: How to solve 500 internal server error problem when uploading files once and for all - Added by Matteo Bagattini over 3 years ago

Junyu, I know it's dirty but I ended up creating folders structure for a some years beforehand, giving the right permissions to www-data.

RE: How to solve 500 internal server error problem when uploading files once and for all - Added by Jackson Jiang 8 months ago

Hello, just curious if we have any update on this issue? the same thing happened on my newly installation. here is my environment

Environment:
Redmine version 3.3.1.stable
Ruby version 2.3.3-p222 (2016-11-21) [arm-linux-gnueabihf]
Rails version 4.2.7.1
Environment production
Database adapter Mysql2

(1-4/4)