Setting up Unicorn with Nginx

gem install unicorn
or
gem 'unciron'

 

1 install Nginx

yum install ...

2 Configuration

vi /etc/nginx/nginx.conf

 It's adviced to run as a seperae user.

Here is a example:

sudo user add -s /sbin/nologin -r nginx
sudo usermod -a -G web nginx ; add nginx user into web group
sudo mkdir /var/www ;this should be the static path in nginx.conf
sudo chgrp -R web /var/www ;set this path to group "web"
sudo chmod -R 775 /var/www ;set group write permission
sudo usermod -a -G web yourusername; Add your current use to be able to modify the contents of this part

 3 Install unicorn

gem install unicorn
or
gem 'unicron'

 install unicorn file

curl -o config/unicorn.rb https://raw.github.com/defunkt/unicorn/master/examples/unicorn.conf.rb

 4. The very basic of the unicorn

APP_PATH = "/var/www/unicorn"
working_directory APP_PATH

stderr_path APP_PATH + "/log/unicorn.stderr.log"
stdout_path APP_PATH + "/log/unicorn.stderr.log"

pid APP_PATH + "/tmp/pid/unicorn.pid"

 5 Startup unicorn

unicorn_rails -c /var/www/unicorn/config/unicorn.rb -D

 

 

posted on 2013-10-01 19:20  小浪鼓  阅读(443)  评论(0编辑  收藏  举报

导航