Last active
August 29, 2015 13:57
-
-
Save bswinnerton/9728913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream app { | |
# Path to Unicorn SOCK file, as defined previously | |
server unix:/tmp/unicorn.babblings.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name ror-study-group-3; | |
# Application root, as defined previously | |
root /var/www/babblings; | |
try_files $uri/index.html $uri @app; | |
location @app { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://app; | |
} | |
error_page 500 502 503 504 /500.html; | |
client_max_body_size 4G; | |
keepalive_timeout 10; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get update | |
apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison nodejs subversion | |
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz | |
tar xvf ruby-2.1.1.tar.gz | |
cd ruby-2.1.1/ | |
./configure | |
make | |
make install | |
gem install bundler | |
mkdir /var/www/ | |
cd /var/www/ | |
git clone https://github.com/bswinnerton/babblings.git | |
cd babblings/ | |
apt-get install postgresql-server-dev-9.1 postgresql | |
su - postgres | |
vi config/database.yml | |
bundle install | |
RAILS_ENV='production' rake db:create | |
sudo -u postgres psql template1 | |
RAILS_ENV='production' rake db:migrate | |
RAILS_ENV='production' rake db:seed | |
apt-get install imagemagick | |
vi config/initializers/secret_token.rb | |
RAILS_ENV='production' rake db:seed | |
RAILS_ENV='production' rails server -p 80 | |
RAILS_ENV='production' rake assets:precompile | |
RAILS_ENV='production' rails server -p 80 | |
vi config/unicorn.rb | |
unicorn_rails | |
RAILS_ENV='production' unicorn_rails | |
apt-get install nginx | |
vi /etc/nginx/sites-available/babblings.conf | |
RAILS_ENV='production' unicorn_rails -c config/unicorn.rb -D | |
man ps | |
ps -ef | grep unicorn | |
ls -l /etc/nginx/sites-available/ | |
ls -l /etc/nginx/sites-enabled/ | |
rm /etc/nginx/sites-enabled/default | |
ln -s /etc/nginx/sites-enabled/default /etc/nginx/sites-available/babblings.conf | |
ln -s /etc/nginx/sites-available/babblings.conf /etc/nginx/sites-enabled/default | |
ls -l /etc/nginx/sites-enabled/ | |
service nginx restart | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the working application directory | |
# working_directory "/path/to/your/app" | |
working_directory "/var/www/babblings" | |
# Unicorn PID file location | |
# pid "/path/to/pids/unicorn.pid" | |
pid "/var/www/babblings/unicorn.pid" | |
# Path to logs | |
# stderr_path "/path/to/log/unicorn.log" | |
# stdout_path "/path/to/log/unicorn.log" | |
stderr_path "/var/www/babblings/log/unicorn.log" | |
stdout_path "/var/www/babblings/log/unicorn.log" | |
# Unicorn socket | |
#listen "/tmp/unicorn.babblings.sock" | |
listen "/tmp/unicorn.babblings.sock" | |
# Number of processes | |
# worker_processes 4 | |
worker_processes 2 | |
# Time-out | |
timeout 30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.digitalocean.com/community/articles/how-to-deploy-rails-apps-using-unicorn-and-nginx-on-centos-6-5