$ curl -sSL https://get.rvm.io | bash -s stable
$ source /home/libuchao/.rvm/scripts/rvm $ rvm -v rvm 1.25.12 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com> ......
$ type rvm rvm is a function ......
$ rvm install 2.1.0 $ rvm use 2.1.0 --default $ ruby -v ruby 2.1.0p0
$ gem sources -r https://rubygems.org/ $ gem sources -a http://ruby.taobao.org/
$ gem install rails --no-ri --no-rdoc -V ...... $ rails -v Rails 4.0.2
$ sudo apt-get install mysql-server libmysqlclient-dev
$ /usr/bin/mysql_secure_installation
mysql> CREATE DATABASE blix_production; mysql> GRANT ALL PRIVILEGES ON blix_production.* TO blix@localhost IDENTIFIED BY "123456"; mysql> flush privileges; mysql> exit
$ mysql -u blix -p blix_production < database.sql
deb http://nginx.org/packages/ubuntu/ precise nginx deb-src http://nginx.org/packages/ubuntu/ precise nginx
$ wget http://nginx.org/keys/nginx_signing.key $ sudo apt-key add nginx_signing.key
$ sudo apt-get update $ sudo apt-get install nginx
$ RAILS_ENV=production rake assets:clean $ RAILS_ENV=production rake assets:precompile
worker_processes 2
timeout 30
APP_PATH = File.expand_path("../..", __FILE__)
working_directory APP_PATH
listen 8080, :tcp_nopush => true
listen "/tmp/unicorn.sock", :backlog => 64
stderr_path APP_PATH + "/log/unicorn.stderr.log"
stdout_path APP_PATH + "/log/unicorn.stdout.log"
pid APP_PATH + "/tmp/pids/unicorn.pid"
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/home/libuchao/blix
APP_USER=libuchao
PID=$APP_ROOT/tmp/pids/unicorn.pid
CMD="unicorn_rails -D -E production -c $APP_ROOT/config/unicorn.rb"
action="$1"
set -u
old_pid="$PID.oldbin"
cd $APP_ROOT || exit 1
sig () {
test -s "$PID" && kill -$1 `cat $PID`
}
oldsig () {
test -s $old_pid && kill -$1 `cat $old_pid`
}
case $action in
start)
sig 0 && echo >&2 "Already running" && exit 0
su -c "$CMD" - $APP_USER
;;
stop)
sig QUIT && exit 0
echo >&2 "Not running"
;;
force-stop)
sig TERM && exit 0
echo >&2 "Not running"
;;
restart|reload)
sig HUP && echo reloaded OK && exit 0
echo >&2 "Couldn't reload, starting '$CMD' instead"
su -c "$CMD" - $APP_USER
;;
upgrade)
if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
then
n=$TIMEOUT
while test -s $old_pid && test $n -ge 0
do
printf '.' && sleep 1 && n=$(( $n - 1 ))
done
echo
if test $n -lt 0 && test -s $old_pid
then
echo >&2 "$old_pid still exists after $TIMEOUT seconds"
exit 1
fi
exit 0
fi
echo >&2 "Couldn't upgrade, starting '$CMD' instead"
su -c "$CMD" - $APP_USER
;;
reopen-logs)
sig USR1
;;
*)
echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
exit 1
;;
esac
$ chmod +x /home/libuchao/blix/config/unicorn_init.sh $ sudo ln -s /home/libuchao/blix/config/unicorn_init.sh /etc/init.d/unicorn $ sudo update-rc.d unicorn defaults
$ service unicorn start
upstream blix_backend {
server unix:/tmp/unicorn.sock fail_timeout=0;
}
gzip on;
gzip_disable "msie6";
client_max_body_size 150m;
server {
listen 80 default;
return 403;
}
server {
listen 80;
server_name libuchao.com www.libuchao.com;
root /home/libuchao/blix/public;
try_files $uri/index.html $uri.html $uri @httpapp;
location @httpapp {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering on;
proxy_pass http://blix_backend;
}
location ~ ^(/assets) {
access_log off;
expires max;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有