1。 安装ruby下载rubyinstaller2.1.5安装,修改source:
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
再就是搜索所有的Gemfile与文字搜索https://rubygems.org,然后替换为淘宝的ruby
2。下载DevKit 4.7.2 安装
3。打开Ruby命令行
4。解压DevKit4.7.2到C盘
5。把Ruby命令行切换到DevKit目录
6。在Ruby命令行输入命令安装DevKit:
ruby dk.rb init
ruby dk.rb install
7。安装rails
gem install rails
8。用rails建立应用
如在D:盘建立:
rails new myapp
9。安装应用附加gem:
在建立的myapp目录下搜索Gemfile,并修改Gemfile中的source为https://ruby.taobao.org
在建立的myapp目录下执行:
bundle install
10。执行 rails server 成功。
11。安装完成
如果Rails的 WEBrick用不了,可以用rails的thin:
1.安装thin
gem install thin
2. 下载nginx解压到目录
3.修改gninx.conf文件,修改成:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream ts1 {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log C:/StandAlone/www/mystandaloneapp.com/log/access.log;
#error_log C:/StandAlone/www/mystandaloneapp.com/log/error.log;
root D:/mywebsites/website1;
index index.html;
location / {
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_redirect off;
try_files D:/mywebsites/website1/maintenance.html $uri $uri/index.html $uri.html @ruby;
}
location @ruby {
proxy_pass http://ts1;
}
}
}
4。启动thin,thin start
5。启动nginx
6.rails thin+nginx 安装完成