Solved

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

Posted on 2011-09-13
7
2,556 Views
Last Modified: 2012-05-12
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
Comment
Question by:Westez
  • 4
  • 3
7 Comments
 
LVL 40

Expert Comment

by:noci
ID: 36534584
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
 

Author Comment

by:Westez
ID: 36536714
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
 
LVL 40

Expert Comment

by:noci
ID: 36537658
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:Westez
ID: 36539486
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
 
LVL 40

Accepted Solution

by:
noci earned 500 total points
ID: 36539998
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
 

Author Comment

by:Westez
ID: 36545187
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
 

Author Closing Comment

by:Westez
ID: 36546427
Thanks again for your help.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question