问题
I'm using Jruby and Warbler to deploy a Jruby on Rails application to a Tomcat server. I can see all of my images when I deploy the server with Webrick: jruby -S server/script. However, when I create a .war file out of the rails directory using jruby -S warble and deploy to Tomcat, none of my images show up on the tomcat server. I noticed that image location has changed to the root of the directory in the war file.
It seems that /images/picturename.jpg would be appropriate, but my images are not showing up.
回答1:
"not showing up" -> 404? You said you noticed the image location changed, did you check that the specific images are present? (jar tf myapp.war
will show you.)
Did you deploy your war under a context path? I.e., if the home page is at /myapp/, then images will be at /myapp/images/picturename.jpg. JRuby-Rack tries to adjust the Rails asset paths for you to include the context path, but there may be some cases where it doesn't. You may want to resort to just setting config.action_controller.asset_host
in config/environments/production.rb
to '/myapp' as well.
回答2:
Did you set up the correct symlinks to your images folder?
f.e. /var/www/website.com/current/20090807200123/public/images --> /var/www/website.com/shared/public
?
来源:https://stackoverflow.com/questions/1191175/warbler-where-are-my-images