Solved

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

Posted on 2011-09-13
7
2,520 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 39

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 39

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 39

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now