Ruby on Rails Thursday, May 3, 2012

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.conf 
http://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

username: rubyonrailsserver 
password: rubyonrailsserver

Following are my instructions to install the production server

01 
install ubuntu server

02 
echo "alias ll='ls -l'" >> ~/.bash_aliases

03 
edit .bashrc and uncomment the loading of .bash_aliases

04 
sudo apt-get update 
sudo apt-get upgrade

05 
sudo dpkg-reconfigure tzdata

06 
sudo apt-get install ntp

07 
sudo ntpdate ntp.ubuntu.com # Update time

08 
sudo hostname your-hostname

09 
Add 127.0.0.1 your-hostname 
sudo vim /etc/hosts

10 
Write your-hostname in 
sudo vim /etc/hostname

11 
sudo apt-get install mysql-server libmysqlclient15-dev

12 
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-rdoc

13 
sudo apt-get install build-essential zlib1g-dev libssl-dev libreadline5-dev

14 
Download and install Ruby Enterprise Edition

wget 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 ./installer

Change target folder to /opt/ruby for easier upgrade later on

15 
Add Ruby Enterprise bin to PATH

echo "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 20090928

16 
sudo apt-get install git-core

17 
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/nginx

21 
sudo /usr/sbin/update-rc.d -f nginx defaults

22 
sudo apt-get remove imagemagick

23 
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-config

24 
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz

25 
tar xvfz ImageMagick.tar.gz

26 
cd ImageMagick-6.7.6-8 
./configure

27 
cd ImageMagick-6.7.6-8 
make

28 
cd ImageMagick-6.7.6-8 
sudo make install

29 
sudo ldconfig

30 
sudo /opt/ruby/bin/ruby /opt/ruby/bin/gem install rmagick

31 
rails new test app

vi Gemfile

remove gem 'sqlite'

bundle

31 
sudo apt-get install vim-nox

32 
rails new testapp -d mysql

33 
cd testapp

input password 
vim config/database.yml

34 
insert gem 'therubyracer' into Gemfile 
vim Gemfile

bundle

rake db:create:all

35 
rails scaffold Post title:string body:text

36 
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.

No comments:

Post a Comment