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<br>sudo mkdir /var/www ;this should be the static path in nginx.conf<br>sudo chgrp -R web /var/www ;set this path to group "web"<br>sudo chmod -R 775 /var/www ;set group write permission<br>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   小浪鼓  阅读(450)  评论(0)    收藏  举报

< 2025年4月 >
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 1 2 3
4 5 6 7 8 9 10

导航

统计

点击右上角即可分享
微信分享提示