MacOS下Rails+Nginx+SSL环境的搭建(上)
来源:互联网 发布:ip地址和端口的关系 编辑:程序博客网 时间:2024/06/03 20:55
这里把主要的步骤写下来,反正我是走了不少弯路,希望由此需求的朋友们别再走类似的弯路.虽说环境是在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-module1.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/
0 0
- MacOS下Rails+Nginx+SSL环境的搭建(上)
- MacOS下Rails+Nginx+SSL环境的搭建(下)
- MacOS下Rails+Nginx+SSL环境的搭建(中)
- Rails在MacOS上搭建Heroku部署环境
- 搭建 Nginx 的 SSL 环境
- Ruby on Rails入门——macOS 下搭建Ruby Rails Web开发环境
- macOS上搭建python环境
- rails + nginx + passenger环境搭建
- Ubuntu14.04下Ruby on rails,Passenger与Nginx的环境搭建
- Linux下搭建Nginx环境的搭建
- Window下Rails环境搭建
- windows 下搭建rails 环境
- Linux下搭建rails环境
- MacOS:VirtualBox下Win10虚拟环境搭建
- macOS下搭建Node.js环境
- macOS系统下搭建Android开发环境
- macOS系统下搭建Android开发环境
- macOS系统下搭建React开发环境
- Chrome OS,互联操作系统(WebOS)典型案例
- runtime-objc_msgSend
- 寒假训练——HDU - 2532 Engine 模拟
- 开启新的篇章
- MySQL数据库设置远程访问权限方法小结 简单,粗暴,有截图
- MacOS下Rails+Nginx+SSL环境的搭建(上)
- NGINX轻松管理10万长连接 --- 基于2GB内存的CentOS 6.5 x86-64
- 关于swift3.0中基于viewConroller修改当前UIStausBarStyle
- Python学习笔记(综述)
- fpga项目整理
- jar包版本介绍(beta,alpha,release),软件的版本介绍
- 关于成为一名嵌入式程序员的日常总结(2)
- (二十一)剑指offer之数组中出现次数超过一半的数字
- Android BLE基础操作框架使用详解