- 浏览: 2552689 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
A Rate-Limiting HTTP Proxy(6)Cookie/HTTPS/TIMER
Cookie Operation
https://github.com/362228416/openresty-web-dev/tree/master/demo12
https://github.com/cloudflare/lua-resty-cookie
HTTPS
https://github.com/362228416/openresty-web-dev/tree/master/demo13
TIMER
https://github.com/362228416/openresty-web-dev/tree/master/demo14
NGX document
https://github.com/openresty/lua-nginx-module#nginx-api-for-lua
Package
try with the example of MD5
https://openresty.org/cn/using-luarocks.html
https://github.com/blunt-object/openresty-luarocks
Install lua ENV
http://sillycat.iteye.com/admin/blogs/2376002
https://www.lua.org/download.html
On MAC
>curl -R -O http://www.lua.org/ftp/lua-5.3.4.tar.gz
unzip the file
>make macosx test
>sudo make macosx install
Verify the installation
>lua -v
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
Where is the file
>which lua
/usr/local/bin/lua
On CentOS
>curl -R -O http://www.lua.org/ftp/lua-5.3.4.tar.gz
unzip the file
http://jackatlinux.blogspot.com/2013/11/installing-lua-and-luarocks-in-centos.html
>make linux
Exception:
lua.c:82:31: fatal error:
readline/readline.h: No such file or directory
#include <readline/readline.h>
Solution:
>sudo yum install readline-devel
>make linux
>sudo make install
>lua -v
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
>which lua
/usr/local/bin/lua
On RaspberryPi
>curl -R -O http://www.lua.org/ftp/lua-5.3.4.tar.gz
unzip the file
Same Exception as CentOS when I do
>make linux test
lua.c:82:31: fatal error: readline/readline.h: No such file or directory
#include <readline/readline.h>
Solution:
>sudo apt-get install libreadline-dev
>make linux test
>sudo make install
>lua -v
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
>which lua
/usr/local/bin/lua
Install luarocks
On MAC
>wget http://luarocks.github.io/luarocks/releases/luarocks-2.4.2.tar.gz
>./configure --prefix=/Users/carl/tool/luarocks-2.4.2
>make build
>sudo make install
Link the bin directory and add to PATH
Verify the installation
>luarocks help
On CentOS
>wget http://luarocks.github.io/luarocks/releases/luarocks-2.4.2.tar.gz
>./configure --prefix=/home/ec2-user/tool/luarocks-2.4.2
>make build
>sudo make install
Lin the bin directory and add to PATH
>sudo ln -s /home/ec2-user/tool/luarocks-2.4.2 /opt/luarocks-2.4.2
>sudo ln -s /opt/luarocks-2.4.2 /opt/luarocks
>luarocks help
On RaspberryPI
>wget http://luarocks.github.io/luarocks/releases/luarocks-2.4.2.tar.gz
>./configure --prefix=/home/carl/tool/luarocks-2.4.2 --with-lua=/usr/local
>make build
>sudo make install
>luarocks help
Search Package
>luarocks search vanilla
Search results:
===============
Rockspecs and source rocks:
---------------------------
vanilla
0.1.0.rc4-1 (rockspec) - https://luarocks.org
0.1.0.rc4-1 (src) - https://luarocks.org
0.1.0.rc3-1 (rockspec) - https://luarocks.org
0.1.0.rc3-1 (src) - https://luarocks.org
0.1.0.rc2-1 (rockspec) - https://luarocks.org
0.1.0.rc2-1 (src) - https://luarocks.org
0.1.rc1-1 (rockspec) - https://luarocks.org
0.1.rc1-1 (src) - https://luarocks.org
0.0.1-1 (rockspec) - https://luarocks.org
0.0.1-1 (src) - https://luarocks.org
Install Package on Local
>luarocks install json4lua --local
List the packages
>luarocks list
Installed rocks:
----------------
json4lua
0.9.30-1 (installed) - /Users/carl/.luarocks/lib/luarocks/rocks
Install MD5 package
>sudo luarocks install md5
Update luarocks
>sudo luarocks install luarocks
Check path
> lua -e "print(package.cpath)"
/usr/local/lib/lua/5.3/?.so;/usr/local/lib/lua/5.3/loadall.so;./?.so
>lua -e "print(package.path)"
/usr/local/share/lua/5.3/?.lua;
/usr/local/share/lua/5.3/?/init.lua;
/usr/local/lib/lua/5.3/?.lua;
/usr/local/lib/lua/5.3/?/init.lua;
./?.lua;
./?/init.lua
>sudo find /usr/local -name md5
Password:
/usr/local/go/src/crypto/md5
>luarocks list
Installed rocks:
----------------
luarocks
2.4.2-1 (installed) - /Users/carl/tool/luarocks-2.4.2/lib/luarocks/rocks
md5
1.2-1 (installed) - /Users/carl/tool/luarocks-2.4.2/lib/luarocks/rocks
https://stackoverflow.com/questions/6803582/luajit-not-seeing-rocks-installed-by-luarocks
http://wgxsoft.blog.163.com/blog/static/17381917120146234053774/
Reinstall luarocks
>sudo ./configure --with-lua="/opt/openresty/luajit" --lua-suffix="jit" --with-lua-include="/opt/openresty/luajit/include/luajit-2.1”
>sudo make build
>sudo make install
>luarocks --version
/usr/local/bin/luarocks 2.4.2
LuaRocks main command-line interface
>luarocks list
Installed rocks:
----------------
md5
1.2-1 (installed) - /usr/local/lib/luarocks/rocks
In my lua Code, I will do
local rocks = require "luarocks.loader"
local md5 = require “md5"
function _M
.index()
-- ngx.say(md5.sumhexa("testforfun"));
ngx.say(
cjson.encode(users))end
It will work pretty well.
package.sh will compile all lua to binary
>cat package.sh
#!/usr/bin/env bash
rm -rf ./dist
mkdir -p dist/app/logs
cp -rf conf dist/app
cp -rf html dist/app
cp -rf lua dist/app
cp -rf lualib dist/app
luajit=/opt/openresty/luajit/bin/luajit
function compile() {
for file in $1
do
if test -f $file
then
$luajit -b $file $file
fi
done
}
compile "./dist/app/lua/web/*"
compile "./dist/app/lua/*"
References:
https://github.com/362228416/openresty-web-dev/tree/master/demo12
https://github.com/362228416/openresty-web-dev/tree/master/demo13
package 1
https://my.oschina.net/362228416/blog/846741
https://luarocks.org/
https://openresty.org/cn/using-luarocks.html
http://blog.leanote.com/post/wechat-fee3/b06945bcb7cc
http://dhq.me/luarocks-a-deployment-and-management-system-for-lua-modules
https://segmentfault.com/a/1190000003920034
package 2
https://luarocks.org/#quick-start
lua notes
http://nanxiao.me/category/%E6%8A%80%E6%9C%AF/lua%E7%AC%94%E8%AE%B0/
Cookie Operation
https://github.com/362228416/openresty-web-dev/tree/master/demo12
https://github.com/cloudflare/lua-resty-cookie
HTTPS
https://github.com/362228416/openresty-web-dev/tree/master/demo13
TIMER
https://github.com/362228416/openresty-web-dev/tree/master/demo14
NGX document
https://github.com/openresty/lua-nginx-module#nginx-api-for-lua
Package
try with the example of MD5
https://openresty.org/cn/using-luarocks.html
https://github.com/blunt-object/openresty-luarocks
Install lua ENV
http://sillycat.iteye.com/admin/blogs/2376002
https://www.lua.org/download.html
On MAC
>curl -R -O http://www.lua.org/ftp/lua-5.3.4.tar.gz
unzip the file
>make macosx test
>sudo make macosx install
Verify the installation
>lua -v
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
Where is the file
>which lua
/usr/local/bin/lua
On CentOS
>curl -R -O http://www.lua.org/ftp/lua-5.3.4.tar.gz
unzip the file
http://jackatlinux.blogspot.com/2013/11/installing-lua-and-luarocks-in-centos.html
>make linux
Exception:
lua.c:82:31: fatal error:
readline/readline.h: No such file or directory
#include <readline/readline.h>
Solution:
>sudo yum install readline-devel
>make linux
>sudo make install
>lua -v
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
>which lua
/usr/local/bin/lua
On RaspberryPi
>curl -R -O http://www.lua.org/ftp/lua-5.3.4.tar.gz
unzip the file
Same Exception as CentOS when I do
>make linux test
lua.c:82:31: fatal error: readline/readline.h: No such file or directory
#include <readline/readline.h>
Solution:
>sudo apt-get install libreadline-dev
>make linux test
>sudo make install
>lua -v
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
>which lua
/usr/local/bin/lua
Install luarocks
On MAC
>wget http://luarocks.github.io/luarocks/releases/luarocks-2.4.2.tar.gz
>./configure --prefix=/Users/carl/tool/luarocks-2.4.2
>make build
>sudo make install
Link the bin directory and add to PATH
Verify the installation
>luarocks help
On CentOS
>wget http://luarocks.github.io/luarocks/releases/luarocks-2.4.2.tar.gz
>./configure --prefix=/home/ec2-user/tool/luarocks-2.4.2
>make build
>sudo make install
Lin the bin directory and add to PATH
>sudo ln -s /home/ec2-user/tool/luarocks-2.4.2 /opt/luarocks-2.4.2
>sudo ln -s /opt/luarocks-2.4.2 /opt/luarocks
>luarocks help
On RaspberryPI
>wget http://luarocks.github.io/luarocks/releases/luarocks-2.4.2.tar.gz
>./configure --prefix=/home/carl/tool/luarocks-2.4.2 --with-lua=/usr/local
>make build
>sudo make install
>luarocks help
Search Package
>luarocks search vanilla
Search results:
===============
Rockspecs and source rocks:
---------------------------
vanilla
0.1.0.rc4-1 (rockspec) - https://luarocks.org
0.1.0.rc4-1 (src) - https://luarocks.org
0.1.0.rc3-1 (rockspec) - https://luarocks.org
0.1.0.rc3-1 (src) - https://luarocks.org
0.1.0.rc2-1 (rockspec) - https://luarocks.org
0.1.0.rc2-1 (src) - https://luarocks.org
0.1.rc1-1 (rockspec) - https://luarocks.org
0.1.rc1-1 (src) - https://luarocks.org
0.0.1-1 (rockspec) - https://luarocks.org
0.0.1-1 (src) - https://luarocks.org
Install Package on Local
>luarocks install json4lua --local
List the packages
>luarocks list
Installed rocks:
----------------
json4lua
0.9.30-1 (installed) - /Users/carl/.luarocks/lib/luarocks/rocks
Install MD5 package
>sudo luarocks install md5
Update luarocks
>sudo luarocks install luarocks
Check path
> lua -e "print(package.cpath)"
/usr/local/lib/lua/5.3/?.so;/usr/local/lib/lua/5.3/loadall.so;./?.so
>lua -e "print(package.path)"
/usr/local/share/lua/5.3/?.lua;
/usr/local/share/lua/5.3/?/init.lua;
/usr/local/lib/lua/5.3/?.lua;
/usr/local/lib/lua/5.3/?/init.lua;
./?.lua;
./?/init.lua
>sudo find /usr/local -name md5
Password:
/usr/local/go/src/crypto/md5
>luarocks list
Installed rocks:
----------------
luarocks
2.4.2-1 (installed) - /Users/carl/tool/luarocks-2.4.2/lib/luarocks/rocks
md5
1.2-1 (installed) - /Users/carl/tool/luarocks-2.4.2/lib/luarocks/rocks
https://stackoverflow.com/questions/6803582/luajit-not-seeing-rocks-installed-by-luarocks
http://wgxsoft.blog.163.com/blog/static/17381917120146234053774/
Reinstall luarocks
>sudo ./configure --with-lua="/opt/openresty/luajit" --lua-suffix="jit" --with-lua-include="/opt/openresty/luajit/include/luajit-2.1”
>sudo make build
>sudo make install
>luarocks --version
/usr/local/bin/luarocks 2.4.2
LuaRocks main command-line interface
>luarocks list
Installed rocks:
----------------
md5
1.2-1 (installed) - /usr/local/lib/luarocks/rocks
In my lua Code, I will do
local rocks = require "luarocks.loader"
local md5 = require “md5"
function _M
.index()
-- ngx.say(md5.sumhexa("testforfun"));
ngx.say(
cjson.encode(users))end
It will work pretty well.
package.sh will compile all lua to binary
>cat package.sh
#!/usr/bin/env bash
rm -rf ./dist
mkdir -p dist/app/logs
cp -rf conf dist/app
cp -rf html dist/app
cp -rf lua dist/app
cp -rf lualib dist/app
luajit=/opt/openresty/luajit/bin/luajit
function compile() {
for file in $1
do
if test -f $file
then
$luajit -b $file $file
fi
done
}
compile "./dist/app/lua/web/*"
compile "./dist/app/lua/*"
References:
https://github.com/362228416/openresty-web-dev/tree/master/demo12
https://github.com/362228416/openresty-web-dev/tree/master/demo13
package 1
https://my.oschina.net/362228416/blog/846741
https://luarocks.org/
https://openresty.org/cn/using-luarocks.html
http://blog.leanote.com/post/wechat-fee3/b06945bcb7cc
http://dhq.me/luarocks-a-deployment-and-management-system-for-lua-modules
https://segmentfault.com/a/1190000003920034
package 2
https://luarocks.org/#quick-start
lua notes
http://nanxiao.me/category/%E6%8A%80%E6%9C%AF/lua%E7%AC%94%E8%AE%B0/
发表评论
-
Update Site will come soon
2021-06-02 04:10 1679I am still keep notes my tech n ... -
Stop Update Here
2020-04-28 09:00 316I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 476NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 369Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 370Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 337Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 431Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 436Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 374Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 456VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 385Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 479NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 424Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 337Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 248GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 452GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 328GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 314Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 319Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 294Serverless with NodeJS and Tenc ...
相关推荐
安装redis_rate支持2个最新的Go版本,并且需要具有支持的Go版本。 因此,请确保初始化Go模块:go mod init github.com/my/repo 然后安装redis_rate / v9(在导入中注意v9 ;忽略它是一个普遍的错误):go get github...
other will be delayed// note maxRPS is a shorthand for perMilliseconds: 1000, and it takes precedence// if specified both with maxRequests and perMillisecondsconst http = rateLimit ( axios . create ...
通过config.json(aka rate-limiting.conf)调整规范。 安全问题:确保您的请求缓存文件不能被公众访问。 用法: [1]编辑您的配置: 笔记: 如果“ die_on_rate_limit”为false,则访问者在受限时将被重定向到“ ...
composer require danharrin/livewire-rate-limiting 引入了速率限制改进功能后,此软件包至少需要Laravelv8.x。 用法 将DanHarrin\LivewireRateLimiting\WithRateLimiting特性应用于您的Livewire组件: <?php ...
haproxy-http-based-rate-limiting 基于HTTP头内容和其他具有HAProxy的高级信息的限速请求的以代码为中心的博客文章的示例配置。 有关如何使用它的详细信息,请参见
部署方式为了使部署工作正常... 在第10个运行服务器上,应返回HTTP状态代码429 Too Many Requests饼干基于cookie的用户标识,如果不存在,则在第一次请求时用户将收到一个cookie CookieName: user-limiter CookieValue:
**速率限制(Rate Limiting)** 速率限制是网络服务中常见的策略,用于防止滥用或保护系统资源。在"Amp-rate-limit.zip"中,可能包含了一个实现速率限制的库或组件,它可能使用令牌桶算法、漏桶算法或其他方法来控制...
在Node.js环境中,速率限制(Rate Limiting)是一种重要的技术,用于控制应用程序接口(API)或服务的访问速度,防止恶意用户滥用系统资源,保护服务器免受DDoS攻击,以及维护服务的稳定性和可用性。"node-rate-...
藏经阁-In-Flux Limiting for a Multi-Tenant Logging Service 本文档主要介绍了 Symantec 公司的内部云团队在多租户日志记录服务中实现 In-Flux 限制的解决方案。该解决方案主要针对多租户日志记录服务中存在的...
fastify-rate-limit 您的路线的低开销速率限制器。 支持 Fastify 2.x - 3.x semver 范围。 Fastify 1.x 兼容性请参考及相关版本。 安装 npm i fastify-rate-limit 用法 注册插件,如果需要,传递一些自定义选项。...
藏经阁-In-Flux Limiting for a Multi-Tenant Logging Service 本文档主要介绍 Symantec 的内部云团队在构建多租户日志记录服务时遇到的挑战和解决方案。该服务使用 InfluxDB 作为时间序数据存储,旨在处理大量的...
在经济学和博弈论的领域内,"供应限制机制"是通过限制可销售商品的数量来调节市场的一种机制。这种机制试图通过拍卖理论来实现最大化的收益,特别是当卖家对竞标者的估值信息知之甚少时。这类机制的核心在于,通过...
A numerical simulation shows that by using electronic equalizers 1 bit/s/Hz spectral efficiency can be attained with the same signal quality as a 0.8 bit/s/Hz system. Waveform distortion due to ...
6. **系统权衡**:服务运营商可以根据实际需求,在通信成本与系统的准确性、效率及可扩展性之间进行权衡选择。 7. **低开销**:在实际测试中,两种设计均表现出极低的额外开销,这对于大规模部署至关重要。 8. **可...
简单速率限制用于node.js Express应用程序的简单限速中间件。 限制应用程序的打开请求数以限制资源利用率,例如套接字连接和内存。 一旦打开的请求太多,则返回...//Or - for limiting only specific routesapp.get('/
7. **Rate Limiting**: 微博网站通常会有反爬策略,如频率限制,因此爬虫可能需要处理这些问题,例如使用`setTimeout`延迟请求,或者使用第三方库如`puppeteer`模拟浏览器行为,减少被封IP的风险。 8. **数据清洗与...
CB速率限制器Couchbase API Rate Limiter是一个超级简单PHP软件包,用于限制对公共API的... 安装CB Rate Limiter的最简单和推荐的方法是通过composer: composer require gnikolovski/cb-rate-limiter如何使用它? 使用
随机模拟MATLAB代码天气描述 该存储库提供了与该论文一起的计算实验:Lee,Jonathan T.,Anderson,Sean,Vergara,Claudio和Callaway,Duncan。 “。” 电力系统研究,(印刷中)。 执照 该代码在MIT许可下提供。...
hapi-rate-limitor建立在以下坚实而hapi-rate-limitor项目之上: 异步速率限制器 伊奥雷迪斯 请求IP 每个程序包都能完美地解决自己的问题。 hapi-rate-limitor将每个问题的解决方案组合成一个针对hapi的固定速率...
克隆项目$ cd rate-limiting -进入项目文件夹入门最快的入门方法是使用 。 $ docker-compose build$ docker-compose up运行测试$ rake spec 终点GET / api / v1 / home Example: ...