当前位置: 首页 > news >正文

设计中国北京2021金华seo建站

设计中国北京2021,金华seo建站,seo品牌优化整站优化,安全的赣州网站建设1. 安装必要的工具和库 apt-get install capnproto luarocksluarocks install lua-capnproto luarocks install lua-cjsonlua-cjson 库不是必须的#xff0c;是由于后面的演示程序要使用#xff0c;就一起装上了。 可以看下库的安装位置#xff1a; root350983744ebf:~# …1. 安装必要的工具和库 apt-get install capnproto luarocksluarocks install lua-capnproto luarocks install lua-cjsonlua-cjson 库不是必须的是由于后面的演示程序要使用就一起装上了。 可以看下库的安装位置 root350983744ebf:~# luarocks show lua-capnprotolua-capnproto 0.1.4-5 - Lua-capnproto is a pure lua implementation of capnproto based on LuaJIT.Lua-capnproto is a pure lua implementation of capnproto based on LuaJIT.License: BSD Homepage: https://github.com/calio/lua-capnproto Installed in: /usr/localModules:capnp (/usr/local/share/lua/5.1/capnp.lua)capnp.compile (/usr/local/share/lua/5.1/capnp/compile.lua)capnp.util (/usr/local/share/lua/5.1/capnp/util.lua)handwritten_capnp (/usr/local/share/lua/5.1/handwritten_capnp.lua)handwritten_data_generator (/usr/local/share/lua/5.1/handwritten_data_generator.lua)random (/usr/local/share/lua/5.1/random.lua)schema_capnp (/usr/local/share/lua/5.1/schema_capnp.lua)test (/usr/local/share/lua/5.1/test.lua)tool (/usr/local/share/lua/5.1/tool.lua)Depends on:lua ~ 5.1 (using 5.1-1)默认库都是安装到了 /usr/local/share/lua/5.1/ 目录下。 2. 编译 capnp 文件 先将 openresty 自带的 luajit 程序目录加入 PATH 路径中 export PATH$PATH:/usr/local/openresty/luajit/bin新建一个AddressBook.capnp 文件内容如下 0xdbb9ad1f14bf0b36; # unique file ID, generated by capnp idstruct Person {id 0 :UInt32;name 1 :Text;email 2 :Text;phones 3 :List(PhoneNumber);struct PhoneNumber {number 0 :Text;type 1 :Type;enum Type {mobile 0;home 1;work 2;}}employment :union {unemployed 4 :Void;employer 5 :Text;school 6 :Text;selfEmployed 7 :Void;# We assume that a person is only one of these.} }struct AddressBook {people 0 :List(Person); } 然后编译 capnp 文件 root350983744ebf:~# capnp compile -olua AddressBook.capnp root350983744ebf:~# ls -lh total 36K -rw-r--r-- 1 root root 532 Oct 22 21:18 AddressBook.capnp -rw-r--r-- 1 root root 21K Oct 22 21:20 AddressBook_capnp.lua得到 AddressBook_capnp.lua 文件。 3. 写一个测试程序 新建一个目录将 AddressBook_capnp.lua 文件放到这个目录。 root350983744ebf:~# mkdir /usr/local/openresty/lua root350983744ebf:~# cd /usr/local/openresty/lua root350983744ebf:/usr/local/openresty/lua# cp /root/AddressBook_capnp.lua .在这目录新建一个 lua 程序文件 main.lua内容如下 local addressBook require AddressBook_capnp local capnp require capnp local cjson require cjson local util require capnp.utillocal data {people {{id 123,name Alice,email aliceexample.com,phones {{number 555-1212,[type] MOBILE,},},employment {school MIT,},},{id 456,name Bob,email bobexample.com,phones {{number 555-4567,[type] HOME,},{number 555-7654,[type] WORK,},},employment {unemployed Void,},},} }local bin addressBook.AddressBook.serialize(data) local decoded addressBook.AddressBook.parse(bin)ngx.say(cjson.encode(decoded))这个程序将一个 lua 数据【数据格式是按照 AddressBook.capnp 文件定义的】序列化成 capnp 二进制数据然后将二进制数据反序列化成 lua 数据最后使用 cjson 库将 lua 数据序列化成 json 格式使用 nginx 输出。 4. 验证程序 修改 nginx 配置文件【 /usr/local/openresty/nginx/conf/nginx.conf】内容为 worker_processes 1;events {worker_connections 1024; }http {lua_package_path /usr/local/openresty/lua/?.lua;;;server {listen 80;server_name localhost;location /capnp {content_by_lua_file /usr/local/openresty/lua/main.lua;}} }启动 nginx 并验证结果 root350983744ebf:~# /usr/local/openresty/nginx/sbin/nginx root350983744ebf:~# root350983744ebf:~# curl 127.0.0.1/capnp {people:[{phones:[{number:555-1212,type:MOBILE}],id:123,name:Alice,employment:{school:MIT},email:aliceexample.com},{phones:[{number:555-4567,type:HOME},{number:555-7654,type:WORK}],id:456,name:Bob,employment:{unemployed:Void},email:bobexample.com}]}和预期相符。
http://www.hkea.cn/news/14414824/

相关文章:

  • 深圳效果图制作公司百度首页排名优化平台
  • 中山专业制作网站外贸论坛有哪些平台
  • 东莞网站开发哪家好微网站模板免费下载
  • 网站开发研究综述最近免费视频中文2019完整版
  • php网站开发pdf做公司网站麻烦吗
  • 建设企业网站的模式wordpress 维护状态
  • 个人网站开发人员wordpress 手机跳转
  • 深圳网站建设列表网北京专业制作网站
  • 企业网站php四川建设厅网站怎么进不去
  • 长沙好的做网站品牌北京企业网站建设哪家服务好
  • 公司网站如何seo上海公司黄页网站
  • 网站规划与建设 试卷to a wordpress
  • 做电商网站用什么语言wordpress for sae
  • 大理装饰公司做网站现在做网站建设都是自建
  • 企业搭建网站多少钱郑州航空港建设局网站
  • 文化网站建设心得福建省建设工程资格中心网站
  • 怎么把自己的网站推广wordpress站点临时关闭
  • 做餐饮培训网站广告WordPress后端API
  • 餐馆效果图网站公众号怎么制作投票
  • 免费网站推广网站在线专业做网站建
  • 电子商务中的网站开发外包app公司不给源代码
  • 国内有什么网站网站建设理论依据
  • 一站建设个人网站乐清网站优化推广
  • 深圳网站建设 设计卓越迈建设网站最强
  • 网站手机版模板kratos wordpress
  • it行业公司排名企业站seo价格
  • 太原市网站建设开一家网站建设公司要多少钱
  • 中小型网站建设与管理总结WordPress纯代码添加
  • 竞价网站做seo北京网络公司建站
  • 浙江交通工程建设集团网站企业网站展示论文