Examples of Ngx_lua use techniques and applications in production environments

Source: Internet
Author: User
Tags ftp install openssl lua

Lua's performance is Super Bull, and this doesn't have to be verbose.

The application scene of Nginx_lua

Network I/O blocking time is much higher than CPU computing time, while upstream resource non bottleneck (scalable) network applications, such as High-performance network middle tier, HTTP REST interface services, etc.

Expect to simplify the system architecture, let the service to the Nginx of the Web site;

Taobao people for NG next page X_lua use summary:

Advantage:

Synchronous non-blocking I/O forms intuitive and easy to understand, concurrent service capability is strong

Low CPU and memory running cost

High bonding with nginx can facilitate the adhesion of existing Nginx module functions

Disadvantage:

New technology solution, Lua compared to PHP, Ruby and other widely used development

Language, peripheral ancillary facilities are not yet sound enough to require time to accumulate

Installation is simple once again, in fact, we use openresty on the line. The author has done a lot of tuning.

It is recommended that you use Openresty. At least in the test environment with this, you can save a lot of search module, toss the module time.

1. Download Nginx wget http://nginx.org/download/nginx-1.2.2.tar.gz 2. Install gcc sudo apt-get install gcc 3. Download Luajit wget It.org/download/luajit-2.0.0-beta10.tar.gz 4. Install Luajit TAR-XZVF luajit-2.0.0-beta10.tar.gz cd luajit-2.0.0-beta10 make && sudo make install 5. Download Ngx_devel_kit (Find on this page: https://github.com/simpl/ngx_devel_kit/tags) wget Https://github.com/simpl/ngx_devel_kit/tarball/master- O simpl-ngx_devel_kit.tar.gz 6. Download the latest lua-nginx-module (Find in this page: Https://github.com/chaoslawful/lua-nginx-module/tags ) wget Https://github.com/chaoslawful/lua-nginx-module/tarball/master-O lua-nginx-module.tar.gz 7. Download Pcre wget ftp://
                                                                                                                                                        ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz TAR-XZVF pcre-8.31.tar.gz                                                                                                                          ./configure && make (if reported "Compile:unrecognized O Ption '-dhave_config_h ', please install sudo apt-get install build-essential) sudo make install 8. Download the Echo module wget https://github.com/
                                                                                                                                           Agentzh/echo-nginx-module/tarball/master-o echo-nginx-module.tar.gz TAR-XZVF echo-nginx-module.tar.gz                                                                                                                          7. Decompression Nginx,ngx_devel_kit, Lua-nginx-module tar-xzvf Nginx-1.2.2.tar. GZ TAR-XZVF simpl-ngx_devel_kit.tar.gz TAR-XZVF lua-nginx-module.tar.gz 8. Install sudo apt-get install OpenSSL libssl-dev su Do apt-get install Libtool CD nginx-1.2.2 export Luajit_lib=/usr/local/lib/export luajit_inc=/usr/local/include/
                     luajit-2.0                                                                                                                          ./configure--user=www-data--group=www-data- -with-debug--with-http_gzip_static_module--with-http_ssl_module--with-http_stub_status_module--with-http_ Realip_module \--prefix=/usr/local/Nginx \--add-module=. /simpl-ngx_devel_kit-4192ba6/\--add-module=. /chaoslawful-lua-nginx-module-b771a2e/\--add-module=.
                                                                                                                                                                                                                /agentzh-echo-nginx-module-8042c62/
Make-j2 sudo make install 

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.