2013年3月1日 星期五

Redmine - 修正檔案上傳失敗

用 Redmine 附檔時只會看到 Internal Server Error 資訊,翻了 /var/log/apache2/error.log 後,看到了神祕句子:


Unexpected error in mod_passenger: An error occured while buffering HTTP upload data to a temporary file in /tmp/passenger.1.0.7336/generation-0/buffered_uploads. The current Apache worker process (which is running as XXX) 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, or set the 'PassengerUploadBufferDir' directive to a directory that Apache can write to.
Backtrace:
  in 'boost::shared_ptr<Passenger::BufferedUpload> Hooks::receiveRequestBody(request_rec*)' (Hooks.cpp:1321)
  in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:585)


這時我才想到,因為我在 Apache 設定時,透過 passenger 並指定 XXX 權限跑 redmine 的,因此會碰到 XXX 無法存取 /tmp 裡頭相關的位置,解法…那就是多建立一個目錄給 redmine 使用吧 :P


$ sudo su XXX
$ mkdir /path/redmine/PassengerUploadBufferDir
$ exit
$ sudo vim /etc/apache2/conf.d/redmine
Alias /redmine "/path/redmine/public"
RailsBaseURI /redmine
<Directory /path/redmine/public>
  AssignUserId XXX XXX
  PassengerUploadBufferDir /path/redmine/PassengerUploadBufferDir
  AllowOverride all
  Options -MultiViews
</Directory>


沒有留言:

張貼留言