安装ruby环境

RVM(ruby版本管理工具)安装

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh

列出所有可用的ruby版本

rvm list known

安装一个ruby版本

rvm install 2.2

或者,安装最新版本

rvm install ruby

设置新版本ruby为默认版本

rvm use 2.2 --default

检查当前ruby版本

ruby -v

安装Nginx

创建nginx源文件

# vi /etc/yum.repos.d/nginx.repo

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

安装nginx

yum -y install nginx

启动nginx并设为自启动服务

chkconfig nginx on
service nginx start

安装Rails和Puma

由于国内网络原因,导致 rubygems.org 存放在 Amazon S3 上面的资源文件间歇性连接失败。

解决办法:

修改Ruby的gem源地址为淘宝的源

gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/

检查Ruby的gem源

gem sources -l

安装rails

gem install rails

查看rails版本

rails -v

安装puma

gem install puma

查看puma版本

puma --version

启动puma

首先,确保你把Puma加入了你的ruby应用的Gemfile文件中。

gem 'puma'

后用Rails命令启动Puma

rails s Puma

配置Nginx

删除默认站点配置文件

rm /etc/nginx/conf.d/default.conf

为你的ruby应用创建一个站点配置文件

# vi /etc/nginx/conf.d/my_app.conf

upstream my_app {
server unix:///var/run/my_app.sock;
} server {
listen 80;
server_name my_app_url.com; # change to match your URL
root /var/www/my_app/public; # I assume your app is located at this location location / {
proxy_pass http://my_app; # match the name of upstream directive which is defined above
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} location ~* ^/assets/ {
# Per RFC2616 - 1 year maximum expiry
expires 1y;
add_header Cache-Control public; # Some browsers still send conditional-GET requests if there's a
# Last-Modified header or an ETag header even if they haven't
# reached the expiry date sent in the Expires header.
add_header Last-Modified "";
add_header ETag "";
break;
}
}

重启nginx

service nginx restart

使用passenger在Centos7部署Puma+Nginx+Ruby on Rails的更多相关文章

  1. CentOS7部署Django,nginx,uwsgi,redis

    前期准备 把所有的软件都传到这个tools文件夹 cd - mkdir tools cd tools/ mkdir /application 安装nginx yum install pcre pcre ...

  2. CentOS7部署FastDFS+nginx模块

    软件下载 # 已经事先把所需软件下载好并上传到/usr/local/src目录了 https://github.com/happyfish100/libfastcommon/archive/V1.0. ...

  3. 详细说明-CentOS7部署FastDFS+nginx模块(包含集群方式)

    软件下载 # 已经事先把所需软件下载好并上传到/usr/local/src目录了 https://github.com/happyfish100/libfastcommon/archive/V1.0. ...

  4. centos7.2环境nginx+mysql+php-fpm+svn配置walle自动化部署系统详解

    centos7.2环境nginx+mysql+php-fpm+svn配置walle自动化部署系统详解 操作系统:centos 7.2 x86_64 安装walle系统服务端 1.以下安装,均在宿主机( ...

  5. CentOS7部署Nginx

    CentOS7部署Nginx 1.准备工作 Nginx的安装依赖于以下三个包,意思就是在安装Nginx之前首先必须安装一下的三个包,注意安装顺序如下: 1 SSL功能需要openssl库,直接通过yu ...

  6. [Ting's笔记Day4]将Ruby on Rails项目部署到Heroku

    今天想笔记的是把自己写的Ruby on Rails项目部署(Deploy)到Heroku! Heroku是Salesforce公司旗下的云端服务商,支持多种程序语言像是Ruby,PHP,Python等 ...

  7. CentOS7部署Django项目

    1. 云服务器 这里使用的是腾讯云选择系统:CentOS7.3 记住云服务器登录密码 2. 配置Python3环境 默认Python环境为python2.7,yum安装是需要python2的环境的 安 ...

  8. centos7+python3.6+nginx+uwsgi+django2的搭建笔记

    公司需上线一套python编写的代码,需要给搭建一套环境  ,本次采用centos7+python3.6+nginx+uwsgi2+django2+mysql5.7的方式来进行搭建 写在部署前 在线上 ...

  9. Linux Centos7部署环境安装-CentOS

    Linux Centos7部署环境安装-CentOS Centos7部署环境安装及Linux常用命令 centos系统下各文件夹的作用 centos7修改系统默认语言 centos7安装rz/sz命令 ...

随机推荐

  1. OA学习笔记-004-Spring2.5配置

    一.jar包 (1)spring.jar (2)Aop包 aspectjrt.jaraspectjweaver.jar (3)动态代理 cglib-nodep-2.1_3.jar (4)日志 comm ...

  2. linux上TCP connection timeout的原因查找

    linux上TCP connection timeout的原因查找 好久没有写文章了, 今天解决了一个网络连接超时的问题, 记录以备查看. 最近在线上nginx经常出现输出connection tim ...

  3. linux kernel API and google android compile guide

    (1)linux kernel API website: http://docs.knobbits.org/local/linux-doc/html/regulator/index.html http ...

  4. [转]IIS上部署网站

    如何在IIS6,7中部署ASP.NET网站 阅读目录 开始 查看web.config文件 在IIS中创建网站 IIS6 添加扩展名映射 IIS6 无扩展名的映射 目录的写入权限 SQL SERVER的 ...

  5. HDOJ/HDU 1015 Safecracker(枚举、暴力)

    Problem Description === Op tech briefing, 2002/11/02 06:42 CST === "The item is locked in a Kle ...

  6. SQL SERVER 自定义函数 整数转成指定长度的16进制 转换成指定长度的16进制 不足补0

    最近做项目扩展的时候,遇到问题就是将整型转换成指定长度的16进制 刚开始就是直接使用 cast(12 as varbinary(4))但是发现这个不能解决我的问题 所以就上网搜了一下,然后改了改,下面 ...

  7. Js 时间轴和拓扑图

    http://code.csdn.net/news/2819345 http://visjs.org/

  8. Codeforces 294E Shaass the Great

    树形DP.由于n只有5000,可以直接枚举边. 枚举边,将树分成两个子树,然后从每个子树中选出一个点分别为u,v,那么答案就是: 子树1中任意两点距离总和+子树2中任意两点距离总和+子树1中任意一点到 ...

  9. 如何在 CentOS 7 上安装 Redis 服务器

    大家好,本文的主题是 Redis,我们将要在 CentOS 7 上安装它.编译源代码,安装二进制文件,创建.安装文件.在安装了它的组件之后,我们还会配置 redis ,就像配置操作系统参数一样,目标就 ...

  10. 4 weekend110的hdfs下载数据源码跟踪铺垫 + hdfs下载数据源码分析-getFileSystem(值得反复推敲和打断点源码)

    Hdfs下载数据源码分析 在这里,我是接着之前的,贴下代码 package cn.itcast.hadoop.hdfs; import java.io.FileInputStream; import ...