openresty
1 什么是openresty
openresty
=nginx
+很多插件
2 openresty与nginx的使用区别
openresty和nginx没有区别,配置文件格式也是一样。启动openresty的docker,进入/usr/local/openresty/nginx/conf
可以找到nginx.conf
这就是配置文件了,这个文件引用了/etc/nginx/conf.d/*.conf
,因而docker的映射文件只需要映射后者即可。
默认有个/etc/nginx/conf.d/default.conf
这个conf文件是以server开始的。
3 能用openresty做什么不一样的
3.1 获取请求内容(url,method,header,queryString/body)
对于http请求,我们一般有请求路径,请求方法,请求头,请求参数(查询参数、内容参数)四个重要的要素,ngx中可以分别获取这些信息。而对于http响应,主要是响应头的一些修改(如:跨域)。
location /test2{
default_type 'text/html';
set $myvar "100";