cd /usr/share/locales
sudo ./install-language-pack zh_CN
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libpq-dev imagemagick libmagickwand-dev
sudo apt-get memcached redis-server
# https://www.linode.com/docs/databases/redis/redis-on-ubuntu-12-04-precise-pangolin
cp ~/.profile ~/.bash_profile
add following code to ~/.bash_profile
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
rbenv install 2.1.3
rbenv global 2.1.3
ruby -v
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
sudo apt-get install apt-transport-https ca-certificates
sudo vim /etc/apt/sources.list.d/passenger.list
insert one of the following lines, depending on your distribution.
deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main
sudo chown root: /etc/apt/sources.list.d/passenger.list
sudo chmod 600 /etc/apt/sources.list.d/passenger.list
sudo apt-get update
sudo apt-get install nginx-extras passenger
Edit /etc/nginx/nginx.conf and uncomment and change to this
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/ubuntu/.rbenv/shims/ruby;
# passenger_friendly_error_pages on; for show error
cd /etc/nginx/sites-available
sudo vim virtual-host-name
server {
server_name virtual-host;
listen 80;
root /home/ubuntu/www/virtual_host_path/current/public;
passenger_enabled on;
rails_env staging; # ruby env
underscores_in_headers on; # fuck nginx http://stackoverflow.com/questions/22856136/why-underscores-are-forbidden-in-http-header-names
gzip on;
gzip_http_version 1.1;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_types text/plain text/css text/xml application/xml application/xml+rss;
location ~* \.(ico|css|gif|jp?g|png)(\?[0-9]+)?$ {
expires max;
}
}
www.pathsource.com 字幕配置
sudo vim /etc/ngnix/ngnix.conf
...
http {
...
resolver 8.8.8.8; //dns server
...
}
sudo vim /etc/nginx/sites-available/www.pathsource.com
server {
...
location ~ /subtitles/(?<videoid>.*).vtt {
proxy_pass http://hls.pathsource.com/$videoid/subtitles/$videoid.vtt;
proxy_set_header Host hls.pathsource.com;
}
...
}
...
sudo ln -nfs /etc/nginx/sites-available/virtual-host-name /etc/nginx/sites-enabled/virtual-host-name
# Bundler
```shell
gem install bundler
gem install whenever
sudo vim /etc/environment
添加 RAILS_ENV=production
mina deploy # 部署 staging 环境
mina deploy on=live # 部署 production 环境