shownb / shownb.github.com

shownb.github.io
shownb.github.io
5 stars 1 forks source link

Nginx与Lua #4

Open shownb opened 7 years ago

shownb commented 7 years ago

OpenResty最佳实践 https://www.gitbook.com/book/moonbingbing/openresty-best-practices/details

跟我学OpenResty(Nginx+Lua)开发http://jinnianshilongnian.iteye.com/blog/2190344

使用Nginx+Lua(OpenResty)开发高性能Web应用http://jinnianshilongnian.iteye.com/blog/2280928

一些关于openresty的博客 http://zivn.me/categories/openresty/ http://chenxiaoyu.org/2012/10/11/luajit-ffi-curl-example.html

别人撸的框架 https://github.com/zhangf911/dodolu http://www.cppblog.com/pwq1989/archive/2014/12/22/209273.html https://github.com/appwilldev/moochine https://github.com/mashijie/finity

https://github.com/362228416/openresty-web-dev 例子 坑 https://groups.google.com/forum/#!topic/openresty/3ylMdtvUJqg 全局变量vm

openrsty的安装 默认安装的组件详细见 http://openresty.org/en/components.html

wget https://openresty.org/download/openresty-1.11.2.3.tar.gz
sudo apt-get update
sudo apt-get install libreadline-dev libpcre3-dev libssl-dev perl libncurses5-dev
tar xzvf openresty-1.11.2.3.tar.gz
cd openresty-1.11.2.3
./configure --with-luajit --with-http_v2_module --with-http_ssl_module
make
make install
#设置环境变量
PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH

nginx -?

创建工作目录

mysql 在线sql操作生成 http://tools.knowledgewalls.com/mysqlcreatetable

模版和它的语法 https://github.com/bungle/lua-resty-template

ngx.re.match 函数 captures, err = ngx.re.match(subject, regex, options?, ctx?, res_table?) 当匹配的字符串找到时,一个Lua table captures会被返回,captures[0]中保存的就是匹配到的字串,captures[1]保存的是用括号括起来的第一个子模式的结果,captures[2]保存的是第二个子模式的结果,依次类似。

让openresty nginx 支持ssl和http2

自签名的SSL证书 使用的是

openssl genrsa -des3 -out test.com.key 1024
openssl req -new -subj "/C=DE/ST=Germany/L=Essen/O=test/OU=ittest/CN=test.com" -key test.com.key -out test.com.csr
openssl rsa -in test.com.origin.key -out test.com.key
openssl x509 -req -days 3650 -in test.com.csr -signkey test.com.key -out test.com.crt

test.com.crt:自签名的证书 test.com.csr:证书的请求 test.com.key:不带口令的Key test.com.origin.key:带口令的Key 还有最好开启ALPN,但需要OpenSSL 1.0.2+

一些ssl的安全配置文章 https://aotu.io/notes/2016/08/16/nginx-https/ https://www.mf8.biz/71/ nginx.conf的配置是

火坑

shownb commented 7 years ago

https://github.com/362228416/openresty-web-dev 例子 坑 https://groups.google.com/forum/#!topic/openresty/3ylMdtvUJqg