首页 > Operation System > debian6上安装tracks

debian6上安装tracks

2012年10月26日 发表评论 阅读评论

又在折腾gtd,在debian 6的vps上安装tracks。

apt-get install git ruby1.8 rubygems1.8 sqlite3 libsqlite3-dev libxml2-dev libxslt-dev
export REALLY_GEM_UPDATE_SYSTEM=1
#上面这个环境变量设置好了下面更新gem到最新版的命令才能正确执行
gem update --system
gem install bundler
cd /website
git clone https://github.com/TracksApp/tracks.git
cd tracks

修改Gemfile,加上如下一句:

gem 'factory_girl', '~> 2.6'
mysql
create database tracks;
grant all privileges on tracks.* to tracks@localhost identified by 'password' with grant option;
flush privileges;
bundle install
cd config
mv database.yml.tmpl database.yml
mv site.yml.tmpl site.yml
#修改site.yml和database.yml(production部分)文件使之适应具体情况
cd ..
bundle exec rake db:migrate RAILS_ENV=production
#设置数据库环境
bundle exec rake assets:precompile
rails server -b 127.0.0.1 -e production
#上面这句是把服务绑定在127.0.0.1这个ip上,避免别人直接访问
#rails server -e production
#用production模式启动服务

最后,再在nginx或apache等web server上把请求proxy过来,下面的配置文件是nginx的:

upstream tracks {
	server	127.0.0.1:3000;
}

server {

	listen   80; ## listen for ipv4

	server_name	tracks.xxx.com;
	server_tokens	off;

	root /website/tracks/public;

	location / {
		try_files $uri $uri/index.html @tracks;
	}

	location @tracks {
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header Host $http_host;
		proxy_set_header X-NginX-Proxy true;
		proxy_pass http://tracks;
		proxy_redirect off;
	}
}
分类: Operation System 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.