安装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. Cxf + Spring3.0 入门开发WebService

    转自原文地址:http://sunny.blog.51cto.com/182601/625540/ 由于公司业务需求, 需要使用WebService技术对外提供服务,以前没有做过类似的项目,在网上搜寻 ...

  2. [mock]10月11日

    第二次mock.出的题是,假设有一个地区不能使用7,都用之后的数字代替,比如8代表7,18代表16(中间有7和17).那么给出一个这个地区的数X,求普通地区的数Y.首先是找规律,发现其实就是找给出的数 ...

  3. Android如何在一个线性布局里完美显示两个listview啊?

    复写一个listView ,在你布局文件中使用此view: <ScrollView android:layout_width="fill_parent" android:la ...

  4. Benefits of Cold Showers: 7 Reasons Why Taking Cool Showers Is Good For Your Health

    Benefits of Cold Showers: 7 Reasons Why Taking Cool Showers Is Good For Your Health Most of us have ...

  5. linux下解压缩jar包

    在部署项目是需要对jar中的文件进行编辑,这就要在linux命令行下对jar进行解压缩操作. 比如有个jar包,/usr/local/EtnetChinaApplication.jar 解包到临时目录 ...

  6. 非sqlite和nigix的开源c项目

    1.http://code.google.com/p/friso/ 一.friso中文分词器 Friso是使用c语言开发的一款高性能中文分词器,使用流行的mmseg算法实现.完全基于模块化设计和实现, ...

  7. android学习——必学基础组件

    android基础组件是一个Android的开发人员必须要了解,且深刻理解的东西: 1.应用程序基础 2.应用程序组件 2.1.活动(Activities) 2.2.服务(Services) 2.3. ...

  8. HTMLTestRunner 自动化测试报告

    http://tungwaiyip.info/software/HTMLTestRunner.html下载,将下载后的文件放在python的Lib目录下 # -*- coding:utf-8 -*- ...

  9. ODAC with Oracle Developer Tools for Visual Studio

    c#开发Oracle数据库的时候,需要本机没有安装过 Oracle 客户端,直接下载 ODAC with Oracle Developer Tools for Visual Studio工具安装即可 ...

  10. 格式化URL

    //格式化url查询参数为json function formatUrl(url){ var reg=/(?:[?&]+)([^&]+)=([^&]+)/g; var data ...