MacOS下Rails+Nginx+SSL环境的搭建(上)
这里把主要的步骤写下来,反正我是走了不少弯路,希望由此需求的朋友们别再走类似的弯路.虽说环境是在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环境的搭建(上)的更多相关文章
- MacOS下Rails+Nginx+SSL环境的搭建(下)
五.以Production环境部署Rails项目 这里插一个题外话,我们之前是以development环境运行的rails项目,现在我们希望在实际的生产系统中跑一下看看.这是十分有必要的,应该在rai ...
- MacOS下Rails+Nginx+SSL环境的搭建(中)
三.配置Nginx 先是修改 hosts 文件,意思是创建一个本地域名以便我们访问,比如: $ sudo subl /etc/hosts 127.0.0.1 rails_project.local 但 ...
- cocos2d-x3.0 macOS下配置Android开发环境以及使用cocos2d-console来新建执行project
下面是子龙山人录制的关于cocos2d-x3.0的视频教程,macOS下配置Android开发环境.使用cocos2d-console来新建执行project.怎样执行cocos2d-x 3.0win ...
- arm-linux下qt + opencv开发环境的搭建(Altera DE1 Soc)
arm-linux-gnueabihf-gcc下载 qt下载 arm-linux下qt + opencv开发环境的搭建(Altera DE1 Soc) Ubuntu 16.04 安装QT arm嵌入式 ...
- windows下配置nginx+php环境
刚看到nginx这个词,我很好奇它的读法(engine x),我的直译是"引擎x",一般引"擎代"表了性能,而"x"大多出现是表示" ...
- (转)windows下配置nginx+php环境
原文地址 http://www.cnblogs.com/huayangmeng/archive/2011/06/15/2081337.html 刚看到nginx这个词,我很好奇它的读法(engine ...
- windows下配置nginx+php环境(转)
刚看到nginx这个词,我很好奇它的读法(engine x),我的直译是“引擎x”,一般引“擎代”表了性能,而“x”大多出现是表示“xtras(额外的效果)”,那么整个词的意思就是类似“极致效果”,“ ...
- windows下python web开发环境的搭建
windows下python web开发环境: python2.7,django1.5.1,eclipse4.3.2,pydev3.4.1 一. python环境安装 https://www.pyth ...
- Ubantu下配置Sublime Text3---python环境的搭建
因为学习机器学习算法的原因,买的参考书籍很多都是python语言进行开发的,因此也想着在Linux系统下配置python的环境.Sublime是一款非常流行的编辑器,可以添加很多小巧有用的插件,同时也 ...
随机推荐
- canvas实现的粒子效果
前言:我的这个share很简单,没什么技术水准,主要是我自己觉得canvas这个标签很cool!,简单实用又能装X,而且又能实现很多看起来很炫的东西. 一 关于canvas <canvas> ...
- linux samba服务配置
1.下载 wget+rpm或yum install 2.配置/etc/samba/smb.conf cat smb.conf | grep setsebool 执行终端打印出来的字符串 setsebo ...
- leetcode 442. Find All Duplicates in an Array 查找数组中的所有重复项
https://leetcode.com/problems/find-all-duplicates-in-an-array/description/ 参考:http://www.cnblogs.com ...
- [LeetCode] Self Dividing Numbers 自整除数字
A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is ...
- [LeetCode] Longest Continuous Increasing Subsequence 最长连续递增序列
Given an unsorted array of integers, find the length of longest continuous increasing subsequence. E ...
- MySQL加载本地数据时出现1290(HY000)错误
- ●洛谷P2606 [ZJOI2010]排列计数
题链: https://www.luogu.org/problemnew/show/P2606题解: 组合数(DP),Lucas定理 首先应该容易看出,这个排列其实是一个小顶堆. 然后我们可以考虑dp ...
- hdu 4812 DTree (点分治)
D Tree Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total S ...
- hdu5652 India and China Origins(并查集)
India and China Origins Accepts: 49 Submissions: 426 Time Limit: 2000/2000 MS (Java/Others) Memo ...
- 例10-4 uva10791(唯一分解)
题意:求最小公倍数为n的数的和的最小值. 如12:(3,4),(2,6),(1,12)最小为7 要想a1,a2,a3……an的和最小,要保证他们两两互质,只要存在不互质的两个数,就一定可以近一步优化 ...