You will get better performance in production if you set config.assets.compile to false in production.rb and precompile your assets. You can precompile with this rake task:
bundle exec rake assets:precompile
If you are using Capistrano, version 2.8.0 has a recipe to handle this at deploy time. For more info, see the "In Production" section of the Asset Pipeline Guide: http://guides.rubyonrails.org/asset_pipeline.html
On Thursday, May 3, 2012 6:55:37 PM UTC+8, Aziz Bookwala wrote:
Hey Vincent--
Your logs would contain a stack trace of what exactly the error was. Could you send that?On Thu, May 3, 2012 at 2:24 PM, Vincent Lin <vincent.open.source.taiwan@gmail.com > wrote:
I try to create a production server and follow the instructions in this document https://github.com/jnstq/rails-nginx-passenger-ubuntu However, my Rails Application can not work properly, and I get a error message, "We're sorry, but something went wrong.".If I browse my application's home page, it works.If I stop nginx server and use WEBrick instead, it works fine.Following is my /opt/nginx/conf/nginx.confhttp://dl.dropbox.com/u/77217614/Rails%20101% 20Install%20Production% 20Server%20Question/nginx.conf I use Virtualbox 4.1.12 to create the production server
Host OS is Mac OS X 10.7.3
Guest OS is Ubuntu 8.04 Server http://releases.ubuntu.com/hardy/ubuntu-8.04.4- server-i386.iso
Here is my Virtualbox Image, http://dl.dropbox.com/u/77217614/Rails%20101% 20Install%20Production% 20Server%20Question/rails_ server.ova username: rubyonrailsserver
password: rubyonrailsserverFollowing are my instructions to install the production server--01
install ubuntu server02
echo "alias ll='ls -l'" >> ~/.bash_aliases03
edit .bashrc and uncomment the loading of .bash_aliases04
sudo apt-get update
sudo apt-get upgrade05
sudo dpkg-reconfigure tzdata06
sudo apt-get install ntp07
sudo ntpdate ntp.ubuntu.com # Update time08
sudo hostname your-hostname09
Add 127.0.0.1 your-hostname
sudo vim /etc/hosts10
Write your-hostname in
sudo vim /etc/hostname11
sudo apt-get install mysql-server libmysqlclient15-dev12
Gemrc
Add the following lines to ~/.gemrc, this will speed up gem installation and prevent rdoc and ri from being generated, this is not nessesary in the production environment.---
:sources:
- http://gems.rubyforge.org
- http://gems.github.com
gem: --no-ri --no-rdoc13
sudo apt-get install build-essential zlib1g-dev libssl-dev libreadline5-dev14
Download and install Ruby Enterprise Editionwget http://
rubyenterpriseedition. googlecode.com/files/ruby- enterprise-1.8.7-2012.02.tar. gz
tar xvfz ruby-enterprise-1.8.7-2012.02.tar.gz
rm ruby-enterprise-1.8.7-2012.02.tar.gz
cd ruby-enterprise-1.8.7-2012.02/
sudo ./installerChange target folder to /opt/ruby for easier upgrade later on
15
Add Ruby Enterprise bin to PATHecho "export PATH=/opt/ruby/bin:$PATH" >> ~/.profile && . ~/.profile
Verify the ruby installation
ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2009092816
sudo apt-get install git-core17
sudo /opt/ruby/bin/passenger-install-nginx-module 18
cd
git clone git://github.com/jnstq/rails-nginx-passenger-ubuntu. git 19
sudo mv rails-nginx-passenger-ubuntu/nginx/nginx /etc/init.d/nginx 20
sudo chown root:root /etc/init.d/nginx21
sudo /usr/sbin/update-rc.d -f nginx defaults22
sudo apt-get remove imagemagick23
sudo apt-get install libperl-dev gcc libjpeg62-dev libbz2-dev libtiff4-dev libwmf-dev libz-dev libpng12-dev libx11-dev libxt-dev libxext-dev libxml2-dev libfreetype6-dev liblcms1-dev libexif-dev perl libjasper-dev libltdl3-dev graphviz gs-gpl pkg-config24
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ ImageMagick.tar.gz 25
tar xvfz ImageMagick.tar.gz26
cd ImageMagick-6.7.6-8
./configure27
cd ImageMagick-6.7.6-8
make28
cd ImageMagick-6.7.6-8
sudo make install29
sudo ldconfig30
sudo /opt/ruby/bin/ruby /opt/ruby/bin/gem install rmagick31
rails new test appvi Gemfile
remove gem 'sqlite'
bundle
31
sudo apt-get install vim-nox32
rails new testapp -d mysql33
cd testappinput password
vim config/database.yml34
insert gem 'therubyracer' into Gemfile
vim Gemfilebundle
rake db:create:all
35
rails scaffold Post title:string body:text36
rake db:migrate RAILS_ENV=production
Please help me to solve this problem.
Many thanks.
Vincent
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ .TIPHJTBE220J
To post to this group, send email to rubyonrails-talk@googlegroups.com .
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com .
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en .
--
- Aziz M. Bookwala
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/h5jas5nCb5kJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment