我剛剛部署了一個rails應用程序,它使用Paperclip來處理文件上傳到運行apache2,passenger,rails 3.2.3和ruby 1.9.3的linux ubuntu 10.04服務器。回形針圖片未能保存在生產軌道
我的設置在開發中工作得很好,但現在在生產中的圖像永遠不會保存。
我在production.rb中註釋掉了以下幾行代碼,以便rails處理文件上傳,並嘗試使用並安裝XSendFile。
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
和我picture.rb
attr_accessible :photo_file_name, :photo_file_size, :photo_content_type, :photo, :splash_image
validates_presence_of :photo_file_name, :photo_content_type, :photo_file_size
has_attached_file :photo,
styles: {
thumb: "150x150>"
},
url: "/assets/splash_images/:id/:style/:basename.:extension",
path: ":rails_root/public/assets/splash_images/:id/:style/:basename.:extension"
validates_attachment_size :photo, :less_than => 25.megabytes
validates_attachment_content_type :photo, content_type: /image/
有誰知道什麼可以怎麼回事?非常感謝
你運行的生產運行在同一臺機器上? – Meduza
您的意思是localhost? nope這是在linux vps服務器上,我還沒有在本地機器上以生產模式運行應用程序 – dodgerogers747
當您上傳文件時,您可以發佈production.log中的日誌嗎? – Meduza