这里把主要的步骤写下来,反正我是走了不少弯路,希望由此需求的朋友们别再走类似的弯路.虽说环境是在MacOS下搭建,但是基本上和linux下的很相像,大家可以举一反三.

一.安装Rails

这个是最简单的,大家可以到我blog看相关文章,安装完毕后创建一个rails项目,比如名字为rails_project,这时你启动rails服务器之后rails s,应该可以在浏览器中访问如下地址的页面:

http://localhost:3000

至此,Rails安装和后台服务都运行正常!

二.安装Passenger和Nginx

首先是gem中安装passenger包:

gem install passenger

敲入如下指令安装Nginx:

passenger-install-nginx-module

1.Yes: download, compile and install Nginx for me. (recommended) The easiest way to get started. A stock Nginx 1.0.10 with Passenger support, but with no other additional third party modules, will be installed for you to a directory of your choice.

2.No: I want to customize my Nginx installation. (for advanced users) Choose this if you want to compile Nginx with more third party modules besides Passenger, or if you need to pass additional options to Nginx's 'configure' script. This installer will 1) ask you for the location of the Nginx source code, 2) run the 'configure' script according to your instructions, and 3) run 'make install'.

在遇到以上选择的时候选择1,当询问Nginx安装路径的时候,建议安装到/usr/local/nginx下.

安装完毕后会在nginx的配置文件中(/usr/local/nginx/conf/nginx.conf)自动加入以下两行:

http { ... passenger_root /Users/Daniel/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.10; passenger_ruby /Users/Daniel/.rvm/wrappers/ruby-1.9.2-p290/ruby; ... }

server { listen 80; server_name www.yourhost.com; root /somewhere/public; # <--- be sure to point to 'public'! passenger_enabled on; }

这时你可以测试一下安装是否成功:

rvmsudo passenger-config validate-install
 * Checking whether this Phusion Passenger install is in PATH... ✓
 * Checking whether there are no other Phusion Passenger installations... ✓

如果你不是通过brew之类安装的nginx, 比如这里我们就不是,你要自己手动添加nginx到执行路径中去:

ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/

MacOS下Rails+Nginx+SSL环境的搭建(上)的更多相关文章

  1. MacOS下Rails+Nginx+SSL环境的搭建(下)

    五.以Production环境部署Rails项目 这里插一个题外话,我们之前是以development环境运行的rails项目,现在我们希望在实际的生产系统中跑一下看看.这是十分有必要的,应该在rai ...

  2. MacOS下Rails+Nginx+SSL环境的搭建(中)

    三.配置Nginx 先是修改 hosts 文件,意思是创建一个本地域名以便我们访问,比如: $ sudo subl /etc/hosts 127.0.0.1 rails_project.local 但 ...

  3. cocos2d-x3.0 macOS下配置Android开发环境以及使用cocos2d-console来新建执行project

    下面是子龙山人录制的关于cocos2d-x3.0的视频教程,macOS下配置Android开发环境.使用cocos2d-console来新建执行project.怎样执行cocos2d-x 3.0win ...

  4. arm-linux下qt + opencv开发环境的搭建(Altera DE1 Soc)

    arm-linux-gnueabihf-gcc下载 qt下载 arm-linux下qt + opencv开发环境的搭建(Altera DE1 Soc) Ubuntu 16.04 安装QT arm嵌入式 ...

  5. windows下配置nginx+php环境

    刚看到nginx这个词,我很好奇它的读法(engine x),我的直译是"引擎x",一般引"擎代"表了性能,而"x"大多出现是表示" ...

  6. (转)windows下配置nginx+php环境

    原文地址 http://www.cnblogs.com/huayangmeng/archive/2011/06/15/2081337.html 刚看到nginx这个词,我很好奇它的读法(engine ...

  7. windows下配置nginx+php环境(转)

    刚看到nginx这个词,我很好奇它的读法(engine x),我的直译是“引擎x”,一般引“擎代”表了性能,而“x”大多出现是表示“xtras(额外的效果)”,那么整个词的意思就是类似“极致效果”,“ ...

  8. windows下python web开发环境的搭建

    windows下python web开发环境: python2.7,django1.5.1,eclipse4.3.2,pydev3.4.1 一. python环境安装 https://www.pyth ...

  9. Ubantu下配置Sublime Text3---python环境的搭建

    因为学习机器学习算法的原因,买的参考书籍很多都是python语言进行开发的,因此也想着在Linux系统下配置python的环境.Sublime是一款非常流行的编辑器,可以添加很多小巧有用的插件,同时也 ...

随机推荐

  1. 【SQL.基础构建-第一节(1/4)】

    --        Tips:数据库与sql--    一.What's 数据库-- 1.数据库(Database,DB):将大量数据保存起来,通过计算机加工而成的可以进行高效访问的数据集合.--   ...

  2. CAdvisor container monitor

    Now cadvisor is useful as a container montor tool. Not only it can monitor many container level metr ...

  3. Windows下Java开发环境安装与配置

    1. 前往Oracle网站下载JDK程序并安装. http://www.oracle.com/technetwork/java/javase/downloads/index.html 目前最新的版本为 ...

  4. [LeetCode] Base 7 基数七

    Given an integer, return its base 7 string representation. Example 1: Input: 100 Output: "202&q ...

  5. elasticsearch logstash jdbc 配置 增量更新

    环境前提: centos 6.5 x64 jdk 1.8 elasticsearch 6.1.4 logstash 6.1.4 kibana 6.1.4 mysql 5.x 保证上面软件已经安装,并且 ...

  6. spring copy中的一个很气人的问题(初学者渣渣的一些感受)

    把别人的工程直接导入使用,出现了各种bug......(细节决定成败,得到以下教训) 1.工程的第一步是检查版本和插件版本兼容问题.很重要 2.然后导入包,看依赖包是否版本太低,(前期做好这些,能让你 ...

  7. Lazy Loading | Explicit Loading | Eager Loading in EntityFramework and EntityFramework.Core

    EntityFramework Eagerly Loading Eager loading is the process whereby a query for one type of entity ...

  8. bzoj1272 Gate Of Babylon

    [问题描述] [输入格式] [输出格式] [样例输入] 2 1 10 13 3 [样例输出] 12 [样例说明] [数据范围] 先容斥,考虑枚举哪些条件强制不满足,即直接选出b[i]+1件宝具 假设强 ...

  9. NOIP 2011 观光公交

    题目描述 风景迷人的小城Y 市,拥有n 个美丽的景点.由于慕名而来的游客越来越多,Y 市特意安排了一辆观光公交车,为游客提供更便捷的交通服务.观光公交车在第 0 分钟出现在 1号景点,随后依次前往 2 ...

  10. 2015 多校联赛 ——HDU5349(水)

    Problem Description A simple problem Problem Description You have a multiple set,and now there are t ...