• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2866
  • Last Modified:

Redmine - Internal error when trying to upload files to /redmine/files directory.

First off this is all new to me.  The probably I'm trying to solve is that we can't upload files to the /redmine/files folder.  We get this error.
Internal error
An error occurred on the page you were trying to access.
If you continue to experience problems please contact your redMine administrator for assistance.

We found the error message and some solutions at this link
http://www.redmine.org/boards/2/topics/19859

I've "chown www.-data:www-data /opt/redmine/files.  And "chmod 775 /opt/redmine/files".
If I change the /opt/redmine/files acl  to 777. I can upload files but the owner is "nobody" and the group is "no group"

I'm trying to determine who passenger is running as so I grepped it and it returns this. It appears that passenger is running from nginx and as nobody.

root     22355     1  0 Sep08 ?        00:00:04 PassengerNginxHelperServer /usr/lib/phusion_passenger ruby 3 4 0 6 0 300 1 nobody 33 33 /tmp/passenger.22353

Here's the nginx passenger.conf file.
more passenger.conf
passenger_root /usr/lib/phusion_passenger;

I tried adding "passengerdefaultuser www-data; to the passenger.conf file but when I restart nginx I get the msg unknown directive "passengerdefaultuser" in /etc/nginx/conf.d/passenger.conf:2

What needs to be done to get this up and rolling?  
I've read the faq's on Phusion, and nginx sites, googled for info etc.

If you need more info, config, or log files let me know.
Below is the info that Redmine faq's mention as helpful.

==========================================================================

ruby 1.8.7 (2010-08-16 patchlevel 302) [i486-linux]
==========================================================================

mysql  Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (i486) using readline 6.1
===========================================================================

Linux server 2.6.32-4-pve #1 SMP Thu Oct 21 09:35:29 CEST 2010 i686 GNU/Linux
===========================================================================

Server version: Apache/2.2.16 (Debian)
===========================================================================

nginx version: nginx/0.7.64
===========================================================================
RAILS_ENV=production script/about
/var/lib/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.7
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          /opt/redmine
Environment               production
Database adapter          mysql
Database schema version   20100819172912
=======================================================================
RAILS_ENV=development script/about
/var/lib/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.7
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          /opt/redmine
Environment               development
Database adapter          mysql
Database schema version   20100819172912

0
Westez
Asked:
Westez
  • 4
  • 3
1 Solution
 
nociSoftware EngineerCommented:
If you enable acl support you can setup an acl to access a file anyway you like:

setfacl getfacl are the tools of trade here..

acls need to be enabled in /etc/fstab specifying the acl option.
also the parent directory needs a default acl to be applied to all files, THis default acl can specify any user you wish.

http://linux.die.net/man/1/getfacl
http://linux.die.net/man/1/setfacl
0
 
WestezAuthor Commented:
What I take away from the Redmine post.  Is that passenger needs to be running as www-data.  And that www-data needs rwx permissions to the /redmine/files directory.

I'm thinking that I need to add "passengerdefaultuser www-data" to the Nginx passenger.conf file.
I will have a look at the links you provided and the cmd's.  I have a bit of an Aix background so I'm not completely unfamiliar with the basic unix cmds.
Have you worked with Nginx, Passenger, Ruby, and Apache?
0
 
nociSoftware EngineerCommented:
I have worked with apache (long time ago), now using lighttpd.
I intend to work with diaspora..., ruby base so that's probably a future thing.


About nobody that is effectively the default:
As it is per documentation:
http://wiki.nginx.org/NginxHttpMainModule#user

So add a line: user www-data www-data
in the global config area.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
WestezAuthor Commented:
It may already be in there.  How's this look?

server:/etc/nginx# cat nginx.conf
user www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    access_log  /var/log/nginx/access.log;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}
0
 
nociSoftware EngineerCommented:
yes on line 2 of the config.

Now regarding passenger, (not running it myself)

   http://www.modrails.com/documentation/Users%20guide%20Nginx.html

is the manual specific to nginx integrating with passenger...  (nginx needs extra support for passenger statements)
Also the username needs to be put in passenger configs, but the spelling is different from your question;

passenger_default_user
passenger_user
passenger_default_group
(including the _ 's)
0
 
WestezAuthor Commented:
Many thanks, I added passenger_default_user to the passenger.conf file and restarted nginx.  No errors on the restart.  And I was able to upload a couple of files.  And the owner of the files is www-data. So it's looking good to me.  I'm waiting on the users to test it and confirm it works for them.
0
 
WestezAuthor Commented:
Thanks again for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now