If you are using Ruby on Rails with Apache (or Apache ITK) and mod_passenger and you get an error while you are trying to upload a file through Rails application, you are probably facing the problem of wrong permissions set in the webserver_private directory of passenger.
Passenger is not currently supporting ITK and is not changing the ownership of the files/dirs correctly.
The error is probably as follows:
[ pid=32497 file=ext/apache2/Hooks.cpp:727 time=2010-10-27 13:47:50.44 ]:
Unexpected error in mod_passenger: An error occured while buffering HTTP upload data to a temporary file in /tmp/passenger.10064/webserver_private. The current Apache worker process (which is running as fainarete) doesn't have permissions to write to this directory. Please change the permissions for this directory (as well as all parent directories) so that it is writable by the Apache worker process.
Hooks::receiveRequestBody(request_rec*, const char*)' (Hooks.cpp:1084)
in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:459)
You have to:
- create a tmp directory in your project directory (home directory or whatever, it should be placed outside of the application though)
- set PassengerUploadBufferDir in the VirtualHost section of your Apache config to the path of the directory you have just created. Remember to give write access to the user the VirtualHost is running from (or 777 with suid).