进行应用开发以前,先开启dev模式html
建立hello world应用
升级hello world应用(容许动态设置页面内容) nginx
1.用ssh登陆云主机,将/data/urlos/master-config/config.json文件的envType的值设置为dev。json
2.打开浏览器登陆URLOS,地址:http://云主机IP:9968或者https://云主机IP:9966。segmentfault
3.在左侧菜单中选择应用管理。而后点击右上角的添加应用按钮。而后在表单页面输入应用的基本信息。以下图:浏览器
应用名称:hello world 版本号:0.1.0dom
应用别名:{ "cn": "hello world","en": "hello world"} 镜像:urlos/nginx:1.14.2-alpine-curl-[启动脚本:sh]。ssh
URLOS最低版本号:0 应用分类:网站环境curl
容器端口:{"80":false, "443":false} 开发者信息:[{"text": "Nginx","url": "http://nginx.org/"}] 标签:nginx 状态:开启测试
描述:{"cn": "hello world"}网站
服务表单步骤:
{ "2": { "cn": "网站", "en": "Website" }, "F": { "cn": "上传下载", "en": "File Transfer" }, "%": { "cn": "Nginx设置", "en": "Nginx Set" } }
这里的步骤对应着建立服务时填写表单信息的步骤。
脚本设置安装脚本:
test -d /run/nginx || mkdir -p /run/nginx
启动脚本:
nginx
状态脚本:(ps -ef|grep "nginx"|grep "master process"|grep -v "grep") && statusScriptResult=1 检查nginx 是否正常运行。监控脚本:{w:statusScript:w} [ "$statusScriptResult" != 1 ] && exit 1 监控nginx是否正常运行。退出脚本:nginx -s stop 容器退出运行时执行的脚本,这里咱们但愿容器退出时关闭nginx。
4.添加nginx虚拟站点的模板文件
模板内容以下:
{w:domains:w}、{w:listenLines:w}这两个变量是URLOS自带的,分别是域名、监听的端口号。
server { server_name {w:domains:w}; {w:listenLines:w} root /data/www; index index.html index.htm; }
5.添加index.html模板文件
6.测试hello world应用。在应用列表找到hello world应用点击右侧更多选择建立服务。填写相关信息,而后提交。
安装完成后,在浏览器访访问地址,检查是否页面内容显示hello world。一块儿动手试试吧。
升级hello world应用
修改模板index.html的内容,将hello world 更改成变量 {w:pageContent:w},而后保存。
点击保存。而后修改刚才建立的hello world服务。在第2项表单中增长了一个网站内容的多行输入框,默认值为hello world。而后咱们将内容改成hello world 2 以下图:
修改完后,须要回到第1步骤,将修改部署方式改成强制部署或者其余部署方式(请不要选择暂不部
署)。而后提交。服务部署完成后,刷新访问地址,页面内容则显示hello world 2。一块儿动手试试吧。