vanilla-zh
  • 简介
  • 快速上手
    • Hello World
    • 如何调试
    • 如何新增一个Controller
    • 如何使用models/dao
    • 如何使用models/service
  • APIs
    • 配置
    • Bootstrap
    • Controllers
    • 模板引擎
    • 插件
    • 路由
    • 异常处理
    • 内建类
  • Libs
    • Cookie
  • 进阶
    • 页缓存
    • 面向对象
    • Vanilla 包开发
  • OpenResty
    • OR文档精炼
      • ngx.timer
      • ngx.config
      • coroutine
      • ngx.thread
  • ChangeLogs
    • vanilla-0.1.0.rc7
    • vanilla-0.1.0.rc6
    • vanilla-0.1.0.rc5
    • vanilla-0.1.0.rc4
    • vanilla-0.1.0.rc3
  • 杂项
    • Nginx执行阶段
    • GDB 调试 OpenResty
    • OpenResty 正则示例收集
    • 基于 OpenResty 安装 Luarocks
    • Vanilla集成的一些优秀第三方包
      • QCon 2015 Broken Performance Tools
  • Vanilla使用经验
    • 用户列表
Powered by GitBook
On this page
  • 安装准备
  • 安装
  • 创建 vanilla 项目
  • vanilla 常用命令

Was this helpful?

  1. 快速上手

Hello World

Previous快速上手Next如何调试

Last updated 6 years ago

Was this helpful?

安装准备

  1. 安装好 OpenResty

  2. Vanilla Github 地址:

安装

# 1.git clone 最新 Vanilla 版本(或者下载相应的 Vanilla release 版本)
git clone https://github.com/idevz/vanilla.git

# 2. 切换到 Vanilla 文件夹
cd vanilla

# 3.编译 vanilla: ./setup-framework -v $VANILLA_PROJ_ROOT -o $OPENRESTY_ROOT 其中 $VANILLA_PROJ_ROOT 为 vanilla 框架安装目录。 -o 为 openresty 安装目录

./setup-framework -v /application/vanilla -o /application/openresty

经过这 3 步如果没有报错,则安装 vanilla 成功

创建 vanilla 项目

#1. 创建 vanilla 的运行用户 

useradd -s /sbin/nologin -M nginx

id nginx # 可以查看到创建的用户

# 2、创建 vanilla 项目, -a 为 项目路径,-u 为执行用户 -g 为用户组 (在根目录 /home/webserver 下创建名为 cms 的项目)

./setup-vanilla-demoapp -a /home/webserver/cms -u nginx -g nginx

# 3、删掉默认 Nginx 服务 

pkill -9 nginx

# 4、切换到项目文件夹 编辑项目配置文件,改成你要的

cd /home/webserver/cms
cd nginx_conf
vim va-nginx.conf
vim va-nginx-development.conf 

# 5、同步配置文件到运行目录

./va-cms-service initconf dev -f #开发模式
./va-cms-service initconf -f #生产模式


# 6、启动项目(2选1)

./va-cms-service start dev  # 启动开发模式
./va-cms-service start  # 启动生产模式

vanilla 常用命令

  1. 启动项目: ./va-cms-service start 或者 ./va-orcms-service start dev

  2. 重启项目 ./va-cms-service restart 或者 ./va-orcms-service restart dev

  3. 停止项目: ./va-cms-service stop 或者 ./va-orcms-service stop dev

  4. 创建配置文件 ./va-cms-service initconf dev -f

服务启动后,开发环境默认启动在 9110 端口, 即可访问

https://github.com/idevz/vanilla
http://localhost:9110