openresty

Want to know openresty? we have a huge selection of openresty information on alibabacloud.com

Openresty: Write a module

It is recommended that you use the Lua module to reuse Lua code. Then, use require () in the user code to call Module code: Module (...) Local mytest = {} function mytest: GETID () Local STR = "123" Return strendreturn mytest There is such a line of code module (...) at the beginning, this is to name the module name with the file name Put the file in "/usr/local/openresty/lualib/lib" (or set lua_package_path) Call: Local test = require "Lib. myt

Use lua-nginx in openresty to create a socket instance

Use lua-nginx in openresty to create a socket instance This article mainly introduces how to use lua-nginx to create a socket instance in openresty. This article provides the code instance and running effect. For more information, see The Lua language is so powerful, at least I think so. The original Lua does not have the Socket function. You need to download the Lua socket component and require it. The l

Openresty Environment Construction

Drizzle installation:Http://agentzh.org/misc/nginx/drizzle7-2011.07.21.tar.gz When you get the drizzle7 2011.07.21 release tarball, you can install libdrizzle-1.0 like this: Tar xzvf drizzle7-2011.07.21.tar.gzCD drizzle7-2011.07.21/./Configure -- without-ServerMake libdrizzle-1.0Make install-libdrizzle-1.0Export libdrizzle_lib =/usr/local/lib Ngx_openresty installation:Download: wget http://agentzh.org/misc/nginx/ngx_openresty-1.2.4.14.tar.gzUnzip: Tar xzvf ngx_openresty-1.2.4.14.tar.gzComp

In windows, openresty uses lua for interface forwarding and secondary encapsulation, and openrestylua

In windows, openresty uses lua for interface forwarding and secondary encapsulation, and openrestylua Requirement: according to the customer's requirements, you can use lua in ngx to encapsulate the interface and re-forward it to the user or a third party. Scenario: If you have requirements for return values, the interface shields fields, or performs some business verification. 1. Download openresty in wind

Openresty notes-access memcache and mysql

: This article mainly introduces openresty notes-accessing memcache and mysql. if you are interested in PHP tutorials, refer to it. worker_processes 1; error_log logs/error.log;events { worker_connections 1024;}http { server { listen 8080; location /hello_world { default_type text/html; cont

"Openresty" passing parameters to Lua code

When I described the Forminputnginxmodule module earlier, I understood how openresty obtained the data of the post submission.Then, if you need to process this data through LUA, you need to pass the data as a parameter into Lua, and Lua gets the data and returns the results to the Nginx to complete the process. First, there is a POST request:1 varJSON = {2Data"hello!"3 };4 $.post (5 'Save', 6 JSON,7 function (callback) {8 alert (callback);9

Openresty WebSocket Use

Openresty websocket use 1. The code is as follows: local server =require"resty.websocket.server" local wb, err = server:new{ timeout =5000, max_payload_len =65535 } ifnot wb then ngx.log(ngx.ERR,"failed to new websocket: ", err) return ngx.exit(444) end whiletruedo local data, typ, err = wb:recv_frame() if wb.fatal then ngx.log(ngx.ERR,"failed to receive frame: ", err) return ngx.exit(444) end if typ

Openresty Server uses Lua script to write Hello World simple instance _lua

Openresty provides a wealth of interfaces and variables to LUA, and developers can leverage the Lua language features and these interfaces for efficient development. Everything is hard at the beginning, but it is half the success of programming to write Hello World. 1. Installation Openresty 2. Configure Nginx Copy Code code as follows: server { Listen 80; server_name localhost;

Create socket instance using Lua-nginx in Openresty

This article mainly introduces the use of Lua-nginx in openresty to create a socket instance, this article directly gives code examples and running effects, need friends can refer to the following The LUA language is too powerful, at least that's how I feel. The original LUA does not have a socket function and requires the user to download the LUA socket component for a require. and the Lua-nginx module with the socket function, and is 100% non-block

modifying upstream backend services with Openresty-lua ecology

0. Benefits of dynamic Upstream Openresty author, recently also open source (not open source when I write this article) they have used the Balancer-by-lua feature, progress issues. Can dynamically modify the upstream, using reverse proxy proxy_pass, to the back-end process or machine: dynamic load balancing control; smooth up and down service, upgrade service; High possible guarantee – Auto kick offline service downline; 1. First, the principle Ideas

Openresty data sharing api.data sharing within an Nginx Worker

Summary from: https://github.com/openresty/lua-nginx-module/#data-sharing-within-an-nginx-worker Data sharing for each nginx worker Define a LUA module and require it in Content_by_lua or Content_by_lua_block.It is recommended to share only read-only data. If you must share mutable data, be sure that the write operation is non-blocking.If you need data shared by all workers, you can choose:Ngx.shared.DICT or memcached , redis , MySQL orPostgre

Openresty notes-access to memcache and MySQL

("Insert error:", err, ":", errno, ":", SQLState, ".") Returnend--selectsql = "SELECT * from ' Test '" local res, err, errno, sqlstate = db:query (SQL) if not res Thenngx.say ("Sel ECT error: ", err,": ", errno,": ", SQLState,". ") ReturnendLocal Cjson = require "Cjson" Ngx.say (Cjson.encode (res))--deletesql = "Delete from ' Test '" local res, err, errno, Sqlstat e = db:query (SQL) if not res thenngx.say ("Delete error:", err, ":", errno, ":", SQLState, ".") Returnend ';} }} The above des

OpenResty query Linux VPS host traffic

The thing is this, I bought a VPS, each month flow is not a lot, I want to see how much traffic. But I do not want to go back to the mainframe, I do not want to use those monitoring software, the advantages of a fuss, so I want to get a script, and then Openresty read out, I have nothing to see eye. Get Traffic data The VPS operating system is CENTOS6, using shell commands or reading a file to get Can read the following two files, Venet0 is the net

Using Openresty to optimize long polling of PHP-FPM

For long polling scenarios, which are more common, the client synchronizes constantly in a synchronous request, and the server decides whether to respond to requests or hold requests to continue checking the data.Since PHP-FPM is single process single-threaded, a process can handle only one request at a time, so for this long polling scenario, a particularly large number of php-fpm processes are needed to handle high concurrency, which is particularly wasteful because most requests are hold on t

Openresty How to decode a URL

URL encoding is an encoding used by HTTP to transmit various parameters at a single URL clock. This encoding will encode special characters (such as ' = ', ' & ', ' + ') in the form of '% ', where is the hexadecimal representation of the character.

Create a socket instance using Lua-nginx in Openresty _lua

The LUA language is too powerful, at least that's how I feel. The original LUA does not have a socket function and requires the user to download the LUA socket component for a require. and the Lua-nginx module with the socket function, and is 100%

openresty+yii2.0 development of high Performance RESTFULAPI Series 3: Developing PHP-based RESTFULAPI

1. Configuring Access URLs in nginx.confWhen you access api1.yingtrader.com/boquote, the boquote.php code is executed. 650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/82/3A/wKiom1dOs3XisFbWAAD-ptQhK4g266.png "title=" Picture 10.png "alt="

Nginx uses Naxsi to build a Web application firewall (WAF), anti-XSS, anti-injection XXX

Naxsi is an open source, efficient and low maintenance rule for Nginx Web application Firewall (Web application Firewall) module. The primary goal of Naxsi is to harden Web applications against SQL injection, cross-site scripting, cross-domain forgery requests, and local and remote file containment vulnerabilities.Website address: Https://github.com/nbs-system/naxsiNaxsi does not require any specific dependencies, it requires Libpcre, LIBSSL, zlib, gzip these Nginx have been integrated.

Calling MongoDB instances with LUA

IntroductionThe company needs to do a similar webmaster statistics project, gave a lot of programs; one scheme is to use Ngx_lua (openresty) call MongoDB to do log storage; Before the project started, I studied the feasibility of this program, write a demo. 1. Prepare(1) Read the openresty should know, Openresty only provide Redis module modules, no MongoDB drive

Installing openresty1.9

OpenrestyOpenresty is a high-performance Web platform based on Nginx and Lua, which integrates a large number of sophisticated Lua libraries, third-party modules, and most of the dependencies. For easy building of dynamic Web applications, Web services, and dynamic gateways that handle ultra-high concurrency and scalability.Openresty through the aggregation of a variety of well-designed nginx modules (mainly by the Openresty team independently develop

Total Pages: 15 1 .... 4 5 6 7 8 .... 15 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.