我試圖上傳大小的圖像文件3.7 MB到Openshift服務器,並得到所有的時間503服務暫時不可用錯誤:的Rails 3 + Carrierwave + jQuery的文件上傳失敗上傳圖像文件Openshift服務器
服務暫時不可用 由於維護停機或容量問題,服務器暫時無法處理您的請求。請稍後再試。 Apache/2.2.15(紅帽)服務器在webauto-webauto.rhcloud.com端口80
當我上傳較小尺寸的圖像時效果很好。 請給我一些建議,我該如何解決這個問題?
class ImageUploader < CarrierWave::Uploader::Base
after :store, :delete_original_file
include CarrierWave::RMagick
storage :fog
def delete_original_file(new_file)
if self.version_name.nil?
self.file.delete if self.file.exists?
end
end
def cache_dir
"#{Rails.root}/tmp/uploads/cache/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def default_url
"#{Rails.root}/public/thumbnail.png"
end
version :original do
process :resize_to_limit => [300, 300], :if=> :dealer_picture?
process :resize_to_limit => [1500, 1500], :if=> :picture?
process :watermark, :if=> :picture?
end
version :medium, :from_version => :original,:if=> :picture? do
process resize_to_limit: [600, 600]
process :watermark
end
version :thumb, :from_version => :medium,:if=> :picture? do
process resize_to_fill: [450, 300]
end
def extension_white_list
%w(jpg jpeg gif png)
end
def watermark
manipulate! do |img|
logo = Magick::Image.read("#{Rails.root}/public/watermark.png").first
img = img.composite(logo, Magick::SouthEastGravity, 25, 25, Magick::OverCompositeOp)
end
end
protected
def picture?(file)
model.class.to_s.underscore=="picture"
end
def dealer_picture?(file)
model.class.to_s.underscore=="dealer_picture"
end
end
你是否在OpenShift提供的免費層? – torresomar
我使用小型基礎設備,升級到Small.highcpu沒有幫助 – maricavor
可以顯示.htaccess文件嗎?我認爲這可能是一個問題max_file_upload_size – torresomar