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.". <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.50.41%20PM.png> If I browse my application''s home page, it works. <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.50.09%20PM.png> If I stop nginx server and use WEBrick instead, it works fine. <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.53.18%20PM.png> <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.53.52%20PM.png> 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 Here is my Virtualbox Image, http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/rails_server.ova 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Aziz Bookwala
2012-May-03 10:55 UTC
Re: nginx problem "We''re sorry, but something went wrong."
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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.". > > > <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.50.41%20PM.png> > If I browse my application''s home page, it works. > > > <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.50.09%20PM.png> > If I stop nginx server and use WEBrick instead, it works fine. > > > <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.53.18%20PM.png> > > > <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.53.52%20PM.png> > 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 > > Here is my Virtualbox Image, > http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/rails_server.ova > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Vincent Lin
2012-May-03 11:08 UTC
Re: nginx problem "We''re sorry, but something went wrong."
Started GET "/posts" for 192.168.1.5 at Thu May 03 17:59:14 +0800 2012 Processing by PostsController#index as HTML Rendered posts/index.html.erb within layouts/application (0.3ms) Completed 500 Internal Server Error in 2ms ActionView::Template::Error (application.css isn''t precompiled): 2: <html> 3: <head> 4: <title>Testapp</title> 5: <%= stylesheet_link_tag "application", :media => "all" %> 6: <%= javascript_include_tag "application" %> 7: <%= csrf_meta_tags %> 8: </head> app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__186315690_75549250'' app/controllers/posts_controller.rb:7:in `index'' Hi Aziz, Many thanks for the advice, above is the error in my log, and I found a solution, http://stackoverflow.com/questions/7275636/rails-3-1-0-actionviewtemplateerrror-application-css-isnt-precompiled 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.". >> >> >> <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.50.41%20PM.png> >> If I browse my application''s home page, it works. >> >> >> <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.50.09%20PM.png> >> If I stop nginx server and use WEBrick instead, it works fine. >> >> >> <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.53.18%20PM.png> >> >> >> <http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/Screen%20Shot%202012-05-03%20at%201.53.52%20PM.png> >> 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 >> >> Here is my Virtualbox Image, >> http://dl.dropbox.com/u/77217614/Rails%20101%20Install%20Production%20Server%20Question/rails_server.ova >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.