Vanilla 的安装
安装准备
- 安装好 OpenResty
- Vanilla Github 地址:https://github.com/idevz/vanilla
安装
# 1.git clone 最新 Vanilla 版本(或者下载相应的 Vanilla release 版本)git clone https://github.com/idevz/vanilla.git# 2. 切换到 Vanilla 文件夹cd vanilla# 3.编译 vanilla: ./setup-framework -v $VANILLAPROJROOT -o $OPENRESTYROOT 其中 $VANILLAPROJROOT 为 vanilla 框架安装目录。 -o 为 openresty 安装目录./setup-framework -v /application/vanilla -o /application/openresty
经过这 3 步如果没有报错,则安装 vanilla 成功
创建 vanilla 项目
#1. 创建 vanilla 的运行用户useradd -s /sbin/nologin -M nginxid 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/cmscd nginxconfvim va-nginx.confvim 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 # 启动生产模式
服务启动后,开发环境默认启动在 9110 端口,http://localhost:9110 即可访问
vanilla 常用命令
启动项目:
./va-cms-service start或者./va-orcms-service start dev重启项目
./va-cms-service restart或者./va-orcms-service restart dev停止项目:
./va-cms-service stop或者./va-orcms-service stop dev创建配置文件
./va-cms-service initconf dev -f
