鼎鼎知识库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14使用OpenResty和Lua编写服务.md 715B

3 jaren geleden
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # `OpenResty`安装
  2. 下载
  3. ```
  4. --下载:wget https://openresty.org/download/openresty-1.13.6.2.tar.gz
  5. --解压:tar -xzf openresty-1.13.6.2.tar.gz
  6. ```
  7. 目录
  8. ```
  9. 进入目录:cd openresty-1.13.6.2
  10. 列出内容:ll
  11. 查看当前OpenResty给予Nginx哪个版本开发:cd bundle, ll, 可以看到nginx的某个版本
  12. ```
  13. 编译
  14. ```
  15. --查看帮助文件:./configure --help | more
  16. --编译:./configure
  17. ```
  18. 添加`lua`代码
  19. ```
  20. --配置文件:sudo nano /etc/nginx/nginx.conf
  21. server {
  22. listen 80;
  23. server_name: example.com
  24. locatioin /lua {
  25. default_type text/html;
  26. content_by_lua 'ngx.say("User-Agent:", ngx.req.get_headers()["User-Agent"])' //放在body
  27. }
  28. }
  29. ```
  30. 运行