简体   繁体   中英

CentOS + Rails + nginx + Unicorn + MySQL + RVM(?) howto?

Can someone point me to a very good recent guide on how to setup CentOS + Rails + nginx + Unicorn + MySQL + RVM(?) ?

Or could provide some instructions here?

I'm also not sure if to use RVM on production server, Will that be a good idea?

RVM, Ruby and Rails is fairly straightforward to setup in CentOS.

Install requirements:

sudo yum install git patch pcre pcre-devel openssl openssl-devel curl curl-devel libxslt-devel libxml2-devel sqlite-devel nginx

Install RVM:

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Reload your profile:

source ~/.bash_profile

Run rvm requirements and install any of the listed dependencies:

rvm requirements

Update rvm (just in case):

rvm get head && rvm reload

Install the latest version of Ruby:

rvm install 1.9.3

Setup your RVM environment:

rvm use 1.9.3@projectname --create --default

Update gems to the latest version:

gem update --system

Install Rails:

gem install rails

Install unicorn:

gem install unicorn

You should check out the defunkt github repo . There are a lot of great configuration files in there for Unicorn and Nginx that work well.

Once you create your rails project, read the comments in the unicorn.rb and nginx files in the defunkt project to configure them correctly.

Yesterday I have started a new example project to show very similar setup:

  • nginx proxy
  • unicorn server
  • sqlite3
  • rvm (head version)
  • ruby-1.9.3-p125
  • bundler
  • rails 3.2
  • capistrano

https://github.com/mpapis/ad

You find there working application with deployment and example nginx config file.

As to the sqlite3 instead of mysql - it's good solution for starting application, you can always switch to bigger database engine when it get's to slow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM