Learn the ngx_openresty openresty install a

Source: Internet
Author: User
Tags install openssl lua openssl openssl version stop script centos server nginx server
Learn the ngx_openresty openresty install a

Openresty (also known as Ngx_openresty) is a fully functional WEB application server. It packs the standard Nginx cores, many of the most commonly used third-party modules, and most of their dependencies.

With many well-designed Nginx modules, Openresty effectively transforms the Nginx server into a powerful Web application server, based on which developers can use the Lua programming language to script Nginx cores and existing Nginx C modules to build An extremely high-performance Web application that can handle more than 10,000 concurrent requests.

Openresty is committed to running your server-side application fully on the Nginx server, leveraging the Nginx event model for non-blocking I/O communication. Not only is the network communication between HTTP clients non-blocking, but also the network communication between many remote back-end of MySQL, PostgreSQL, Memcached, and Redis is not blocked.

Because the maintainer of the Openresty package is also the author of many of the Nginx modules packaged in it, Openresty can ensure that all of the components that are included can work reliably together.

Give a few links to the address to understand its powerful features:



https://openresty.org

Https://github.com/SinaMSRE/ABTestingGateway

Https://www.gitbook.com/book/moonbingbing/openresty-best-practices/details


In fact, the compiler installation is very simple, as long as the openresty need to install the dependent package can be.

Linux system CentOS Server version: Installation dependencies:

Yum install readline-devel pcre-devel openssl-devel gcc
Unzip the downloaded compressed file.
./configure

Make
Make install

Mac system, what I ran into was OpenSSL.

But fortunately, someone has developed a homebrew package management tool. http://brew.sh

Please download and install yourself.

Installation steps:

Brew Update
Brew Install OpenSSL
Brew Link--force OpenSSL

Look at the version:
OpenSSL version-a

Reference: Http://apple.stackexchange.com/questions/126830/how-to-upgrade-openssl-in-os-x


Default installation path under Mac System:/usr/local/openresty


To facilitate configuration and stop Nginx, write a few handy scripts:



To facilitate the management of Nginx configuration files, place the Nginx configuration in the ~/etc/nginx directory:

The secondary start Stop script content that is delegated in this directory:


To start the Nginx script:

#! /bin/bash
/usr/local/openresty/nginx/sbin/nginx-p ~/etc/nginx-c ~/etc/nginx/nginx.conf


Stop script:

#! /bin/bash
/usr/local/openresty/nginx/sbin/nginx-s quit-p ~/etc/nginx-c ~/etc/nginx/nginx.conf


Reload configuration:

#! /bin/bash
/usr/local/openresty/nginx/sbin/nginx-s reload-p ~/etc/nginx-c ~/etc/nginx/nginx.conf


~/etc/nginx/nginx.conf configuration file has made some changes:



#user nobody;
Worker_processes 1;


#error_log Logs/error.log;
#error_log Logs/error.log Notice;
#error_log Logs/error.log Info;


PID Logs/nginx.pid;




Events {
Worker_connections 1024;
}




HTTP {

Include lua.conf;


To move the configuration to the Lua script file:

Content:

server {
Listen 8080;
server_name localhost;


Location/lua {
Default_type ' text/html ';

Content_by_lua ' Ngx.say ("Hello Doctor") ';
}


location/p {

Rewrite_by_lua_file Luascript/rout.lua;
}


}


Under test, please automatically change the line permissions before running the script:

Access results:


is not ready to run.

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.